First of all, I'm developing an application with QtJambi. When I was using QStackedWidget I ran into this problem and could not find a suitable solution. So what I did was try to isolate the problem, which I did in the following code:
public class Test{
public static void main(String[] args){
QApplication.initialize(args);
QWidget main = new QWidget();
QVBoxLayout vbox = new QVBoxLayout();
QPushButton bot = new QPushButton("a");
vbox.addWidget(bot);
main.setSizePolicy(Policy.Maximum, Policy.Maximum);
vbox.setContentsMargins(0, 0, 0, 0);
vbox.setStretchFactor(bot, 1); //remove this line to have a totally different size
main.setLayout(vbox);
main.show();
QApplication.exec();
}
}
So I think I might have run into a bug (I could be wrong of course, I tried both versions qtjambi 4.7.1 and 4.7.0, compiling for ubuntu 12.10) and would like a confirmation on it.
On the line of code I pointed out, try removing it andthe widget changes size unexpectedly, maybe it is intended? https://qt-project.org/doc/qt-4.8/qwidget.html#adjustSize says minimum height is 100, but it seems not to be like that, either I use expanding policy or not.