Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.3, 5.15.4
-
Windows 10 20H2 19042.870, 27" 4k screen, 150% scaling in system settings.
-
-
4d4eb11fe340bf0b3a1ce0caae62d9319bf941cf (qt/qtbase/dev) d9697f9f5df2b555997d66695b57f926908057ee (qt/qtbase/6.1)
Description
Consider the following example:
class TestWidget: public QWidget { public: QSize sizeHint() const { return QSize(300, 300); } QSize minimumSizeHint() const { return QSize(100, 100); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); QDialog dialog; auto dialogLayout = new QVBoxLayout(&dialog); auto mainWidget = new QWidget; auto mainLayout = new QVBoxLayout(mainWidget); dialogLayout->addWidget(mainWidget); auto label = new QLabel("Test"); label->setWordWrap(true); mainLayout->addWidget(label); auto widget1 = new TestWidget; widget1->setStyleSheet("QWidget {background-color:red;}"); auto scroll1 = new QScrollArea; scroll1->setWidget(widget1); scroll1->setWidgetResizable(true); mainLayout->addWidget(scroll1); auto widget2 = new TestWidget; widget2->setStyleSheet("QWidget {background-color:green;}"); auto scroll2 = new QScrollArea; scroll2->setWidget(widget2); scroll2->setWidgetResizable(true); mainLayout->addWidget(scroll2); dialog.show(); return a.exec(); }
On Windows we cannot decrease the window size and looks like for widgets minimumSizeHint became equal to sizeHint. On Linux works fine. Check Text_no_Resize.gif
I also see this message in the console on application start:
QWindowsWindow::setGeometry: Unable to set geometry 640x480+1731+706 (frame: 662x536+1720+661) on QWidgetWindow/"QDialogClassWindow" on "\\.\DISPLAY1". Resulting geometry: 640x699+1731+706 (frame: 662x755+1720+661) margins: 11, 45, 11, 11 minimum size: 165x309 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=187,365 maxtrack=0,0)
If we either remove the wordWrap or remove the intermediate mainWidget item we can shrink widgets: Text_Resize.gif
Size hints looks reasonable:Size_Hints.gif
If wrap both widgets (red and green) with their scroll areas into a splitter, we can resize widgets but still can't shrink the window: Splitter.gif