summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidgetwindow.cpp
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2019-11-07 09:27:42 +0200
committerKari Oikarinen <kari.oikarinen@qt.io>2019-11-07 09:27:42 +0200
commit1930af194c10d530f52d60be029ffe70892dedaa (patch)
tree6bc962196ce8a284a6b86f1a01bc2a3cb1c1440c /src/widgets/kernel/qwidgetwindow.cpp
parentf73cd386c31aaa2f8a3386dd5fea00f654b209eb (diff)
parent40b33adb7ab5d0295fa95cf66a8d3f59c8d11739 (diff)
Merge 5.12 into 5.12.6
Diffstat (limited to 'src/widgets/kernel/qwidgetwindow.cpp')
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index fbc71cd0ea..c3f570ce4f 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -72,10 +72,18 @@ public:
void setVisible(bool visible) override
{
Q_Q(QWidgetWindow);
- if (QWidget *widget = q->widget())
+ if (QWidget *widget = q->widget()) {
+ // Check if the widget was already hidden, as this indicates it was done
+ // explicitly and not because the parent window in this case made it hidden.
+ // In which case do not automatically show the widget when the parent
+ // window is shown.
+ const bool wasHidden = widget->testAttribute(Qt::WA_WState_Hidden);
QWidgetPrivate::get(widget)->setVisible(visible);
- else
+ if (!wasHidden)
+ widget->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
+ } else {
QWindowPrivate::setVisible(visible);
+ }
}
QWindow *eventReceiver() override {