summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBłażej Szczygieł <spaz16@wp.pl>2016-01-02 23:04:09 +0100
committerBłażej Szczygieł <spaz16@wp.pl>2016-01-13 19:02:34 +0000
commit7b63c45df58a97bb3e800dd5fe20f41e11f92c62 (patch)
treef20cb96fae03327cd5f06cafd1c601eb192bbc48
parenta9c0a83207599599c2ff67ff00fc7e0cc638a870 (diff)
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>
-rw-r--r--src/widgets/kernel/qwidget.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 229cfc0f85..d2e760da90 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1487,9 +1487,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (extra && !extra->mask.isEmpty())
setMask_sys(extra->mask);
- // If widget is already shown, set window visible, too
- if (q->isVisible())
+ 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
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())