From 37f326297d45564298a2c8cb1958a81b858de57c Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 10 Mar 2015 16:59:50 +0100 Subject: QtWidgets: don't set Qt::WA_OutsideWSRange for 0-sized non-windows If a widget which is not a window has a width or height of 0 that doesn't mean we don't have to invalidate its backing store. On the contrary, the backing store must be invalidated in order to clear stale contents from previous paint events. A window, however, can be completely ignored if it shrinks to 0 as the window system will take care of it. We don't have to clear the attribute for non-windows, either. In Qt4 we use the Qt::WA_OutsideWSRange attribute only for widgets which are windows when determining what to do with a geometry change. See qwidget_x11.cpp or widget_win.cpp in Qt4. Task-number: QTBUG-42727 Change-Id: I3655737057b803ad4b92601a9851055a81bd4b6d Reviewed-by: Paul Olav Tvete --- src/widgets/kernel/qwidget.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 65b861bc68..1c86e8cf7a 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7131,14 +7131,16 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) bool needsShow = false; - if (!(data.window_state & Qt::WindowFullScreen) && (w == 0 || h == 0)) { - q->setAttribute(Qt::WA_OutsideWSRange, true); - if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) - hide_sys(); - data.crect = QRect(x, y, w, h); - } else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) { - q->setAttribute(Qt::WA_OutsideWSRange, false); - needsShow = true; + if (q->isWindow()) { + if (!(data.window_state & Qt::WindowFullScreen) && (w == 0 || h == 0)) { + q->setAttribute(Qt::WA_OutsideWSRange, true); + if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) + hide_sys(); + data.crect = QRect(x, y, w, h); + } else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) { + q->setAttribute(Qt::WA_OutsideWSRange, false); + needsShow = true; + } } if (q->isVisible()) { -- cgit v1.2.3