QtWidgets: Don't show window of native widget with WA_OutsideWSRange

This patch prevents visibility of native widgets which for some reasons
has width or height of 0.

Due to async expose event in Qt5 we must force "hide_sys()" during
resizing for widgets with WA_OutsideWSRange flag. This avoid problems
for non-native and visible widgets which are converted to native and
then resized:
child->winId();
child->resize(0, 0);

Task-number: QTBUG-49445
Change-Id: Ied62a4f253f89447941b2dc03316db8c168f4bb5
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
This commit is contained in:
Błażej Szczygieł 2016-01-02 23:04:09 +01:00
parent a9c0a83207
commit 7b63c45df5

View File

@ -1487,9 +1487,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (extra && !extra->mask.isEmpty())
setMask_sys(extra->mask);
if (data.crect.width() == 0 || data.crect.height() == 0) {
q->setAttribute(Qt::WA_OutsideWSRange, true);
} else if (q->isVisible()) {
// If widget is already shown, set window visible, too
if (q->isVisible())
win->setVisible(true);
}
}
#ifdef Q_OS_WIN
@ -7210,7 +7213,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
if (q->isWindow() || q->windowHandle()) {
if (!(data.window_state & Qt::WindowFullScreen) && (w == 0 || h == 0)) {
q->setAttribute(Qt::WA_OutsideWSRange, true);
if (q->isVisible() && q->testAttribute(Qt::WA_Mapped))
if (q->isVisible())
hide_sys();
data.crect = QRect(x, y, w, h);
} else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) {
@ -7927,8 +7930,10 @@ void QWidgetPrivate::show_sys()
else
QApplication::postEvent(q, new QUpdateLaterEvent(q->rect()));
if (!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow))
if ((!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow))
|| q->testAttribute(Qt::WA_OutsideWSRange)) {
return;
}
if (window) {
if (q->isWindow())