Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.8.0 Beta2, 6.8.0 Beta3, 6.8.0 Beta4, 6.9
-
None
-
-
b78baf634 (dev), bb80366b1 (6.8)
Description
In qtbase/tests/manual/examples/widgets/touch/fingerpaint example,
QMainWindow is invisible and only the black blank screen is shown in Qt6.8beta.
It displays and works properly with the same source in Qt6.7.2.
I'm trying to simplify mainwindow.cpp, it seems to be a problem under the following conditions:
- Call QMainWindow::resize() before show() or showMaximized() and QApplication::exec()
- The widget in the QMainWindow has zero minimumSize
- Have menubar
So simplified MainWindow class is here.
class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow() : QMainWindow() { widget = new QWidget(); setCentralWidget(widget); fileMenu = new QMenu("&File", this); menuBar()->addMenu(fileMenu); menuBar()->adjustSize(); resize(500, 500); } private: QWidget *widget; QMenu *fileMenu; };
When I'm simplifying the example, I found some conditions above, in the other words, it seems no problem if ..
- Remove call to resize()
- or Replace QWidget to QLabel
- or Remove menubar
even if it is in Qt6.8.
By comparison, in all cases QMainWindow::setVisible(true) is called from
QMainWindow::showMaximized() , but QMainWindow is not visible if Qt::WA_OutsideWSRange is set, and this property is set at QWidget::setGeometry_sys()
called from QLayout::activate() internally.
Testing Qt::WA_OutsideWSRange and returns without setting visibility at:
https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/kernel/qwidget.cpp#n8122
Set Qt::WA_OutsideWSRange property at:
https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/kernel/qwidget.cpp#n7292
And I looked into when this problem started, and it seems that
there was no problem before the commit 76ebf51b.
https://codereview.qt-project.org/c/qt/qtbase/+/554052
Now it is strange that this commit doesn't seem to have anything to do with
Qt::WA_OutsideWSRange property..