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 <paul.tvete@theqtcompany.com>
This commit is contained in:
Ulf Hermann 2015-03-10 16:59:50 +01:00
parent 70f92f8cee
commit 37f326297d

View File

@ -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()) {