Details
-
Bug
-
Resolution: Cannot Reproduce
-
P2: Important
-
4.2.2
-
None
Description
This makes it impossible to design fixed-size dialogs that are larger than that. I.e. if the sizeHint of the dialog is i.e. 750 x 500, which is a perfectly valid size for a 800x600 display, then the dialog will actually show up with a size of 533 x 333 pixels:
#include <QtGui>
class Dialog : public QDialog
{
public:
Dialog()
protected:
void resizeEvent(QResizeEvent *e)
};
int main (int argc, char** argv)
{
QApplication app(argc, argv);
Dialog w;
w.adjustSize();
w.setFixedSize(w.size());
w.show();
return app.exec();
}
The responsible code is in qwidget.cpp in the adjustSize function:
s.setWidth(qMin(s.width(), screen.width()*2/3));
s.setHeight(qMin(s.height(), screen.height()*2/3));
If the widget is not resized explicitly as above, then Qt will call adjustSize() when showing the widget, and in that case not limit the size to the screen. This allows the workaround to set the resizeMode of the layout instead to QLayout::Fixed, i.e.
w.layout()->setResizeMode(QLayout::Fixed);