Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P2: Important
-
Resolution: Duplicate
-
Affects Version/s: 5.12.4
-
Fix Version/s: 5.12.5
-
Component/s: Widgets: Widgets and Dialogs
-
Labels:None
-
Environment:Windows 10
-
Platform/s:
-
Commits:deac052a40c93633041da058d5c73c9e91aa76c7
Description
The attached project demonstrates an issue where top-level widgets appear blank after being minimized and restored. I tested this with Qt 5.12.4 on Windows using the MSVC2015 compiler.
EDIT: This issue does no longer occurs with Qt 5.13.0
In the code below, we create a QMainWindow with a button that shows another top-level widget. After pressing the button for the first time, the window frame of the top-level-widget behaves as expected. It can be minimized and restored.
However, if you:
- close the top-level widget,
- press the button to open the top-level widget again,
- minimize the top-level widget,
- and restore it from the Windows taskbar,
the widget appears blank:
Only after using the maximize/restore buttons or manually resizing the window, the window content reappears.
Test code:
int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow w; w.setWindowTitle("Main Window"); // setup a top-level widget QWidget topLevelWidget; { QVBoxLayout *const topLevelWidgetLayout = new QVBoxLayout(&topLevelWidget); QLabel *const testLabel = new QLabel(&topLevelWidget); testLabel->setText("Is this text visible?"); testLabel->setStyleSheet("background-color: #00FFFF;"); testLabel->setMinimumSize(200, 200); topLevelWidget.setLayout(topLevelWidgetLayout); topLevelWidgetLayout->addWidget(testLabel); } // setup button that shows the top level window QPushButton *const openCustomWidgetButton = new QPushButton; { openCustomWidgetButton->setText("Open Second Window"); QObject::connect(openCustomWidgetButton, &QPushButton::clicked, [&topLevelWidget]() { if (topLevelWidget.isVisible()) return; qDebug() << "showing top-level widget"; topLevelWidget.showNormal(); topLevelWidget.activateWindow(); topLevelWidget.raise(); }); } w.setCentralWidget(openCustomWidgetButton); w.show(); return a.exec(); }
Attachments
Issue Links
- duplicates
-
QTBUG-77114 Regression: Black scene after QQuickWidget closed and shown
-
- Closed
-