summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmdisubwindow.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2019-06-20 16:53:24 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2019-06-21 13:09:46 +0200
commitcfd2cc91fdae40d8e1eddfc2f9ff2585a0b708e4 (patch)
tree56cbef0cc9356fa199c93b3977c20ec40f6ff6c9 /src/widgets/widgets/qmdisubwindow.cpp
parenta22a6c01f8d24a64adaa9988eab9831e42686de4 (diff)
Always fill the background of a tabbed QMdiSubWindow
QMacStyle polishes QMdiSubWindows to have autoFillBackground set to false. If the QMdiSubWindow's widget also doesn't fill the background (like QLabel), then nobody fills the window in a tabbed QMdiArea, and the other subwindows show through. This change makes sure that all pixels are painted in that situations, using the styled frame. Fixes: QTBUG-76214 Change-Id: Iae025d15d36a8bc0d0c5838ac43c9d54944bcc83 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/widgets/widgets/qmdisubwindow.cpp')
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 794674c427..e9511f944f 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -3140,8 +3140,6 @@ void QMdiSubWindow::paintEvent(QPaintEvent *paintEvent)
}
Q_D(QMdiSubWindow);
- if (isMaximized() && !d->drawTitleBarWhenMaximized())
- return;
if (d->resizeTimerId != -1) {
// Only update the style option rect and the window title.
@@ -3161,6 +3159,17 @@ void QMdiSubWindow::paintEvent(QPaintEvent *paintEvent)
}
QStylePainter painter(this);
+ QStyleOptionFrame frameOptions;
+ frameOptions.initFrom(this);
+ frameOptions.state.setFlag(QStyle::State_Active, d->isActive);
+ if (isMaximized() && !d->drawTitleBarWhenMaximized()) {
+ if (!autoFillBackground() && (!widget() || !qt_widget_private(widget())->isOpaque)) {
+ // make sure we paint all pixels of a maximized QMdiSubWindow if no-one else does
+ painter.drawPrimitive(QStyle::PE_FrameWindow, frameOptions);
+ }
+ return;
+ }
+
if (!d->windowTitle.isEmpty())
painter.setFont(d->font);
painter.drawComplexControl(QStyle::CC_TitleBar, d->cachedStyleOptions);
@@ -3168,10 +3177,7 @@ void QMdiSubWindow::paintEvent(QPaintEvent *paintEvent)
if (isMinimized() && !d->hasBorder(d->cachedStyleOptions))
return;
- QStyleOptionFrame frameOptions;
- frameOptions.initFrom(this);
frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this);
- frameOptions.state.setFlag(QStyle::State_Active, d->isActive);
// ### Ensure that we do not require setting the cliprect for 4.4
if (!isMinimized() && !d->hasBorder(d->cachedStyleOptions))