diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-03-13 11:24:48 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-03-21 13:39:51 +0000 |
commit | a1c37462eebddf4ad7bc3192f1f3e9a3f7292b19 (patch) | |
tree | 3547c5ea0860777cea1eb97958c1e9432208cee4 /src/gui | |
parent | c45f2eab8553a40d7185ed95b4ab3e45e95c8d70 (diff) |
Windows: Fix tooltip flicker on GL surfaces
QPlatformWindow::initialGeometry() would assign a default height to
the initial geometry of the QRollEffectClassWindow since it has height
of 0. This causes the obtained geometry to not match and subsequently
a geometry change being sent synchronously.
Introduce a new flag QWindowPrivate::resizeAutomatic similar to the
existing QWindowPrivate::positionAutomatic to prevent assigning a
default size and pass through the geometry as is where required.
Fixes: QTBUG-74176
Change-Id: I70c66490838a2c4dfe200ec86094d28bd984dd03
Reviewed-by: Kati Kankaanpaa <kati.kankaanpaa@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 50f05721f7..24cfd32ace 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -708,10 +708,11 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, const QScreen *screen = effectiveScreen(w); if (!screen) return initialGeometry; + const auto *wp = qt_window_private(const_cast<QWindow*>(w)); QRect rect(QHighDpi::fromNativePixels(initialGeometry, w)); - rect.setSize(fixInitialSize(rect.size(), w, defaultWidth, defaultHeight)); - if (qt_window_private(const_cast<QWindow*>(w))->positionAutomatic - && w->type() != Qt::Popup) { + if (wp->resizeAutomatic) + rect.setSize(fixInitialSize(rect.size(), w, defaultWidth, defaultHeight)); + if (wp->positionAutomatic && w->type() != Qt::Popup) { const QRect availableGeometry = screen->availableGeometry(); // Center unless the geometry ( + unknown window frame) is too large for the screen). if (rect.height() < (availableGeometry.height() * 8) / 9 diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index bf5e645114..af1233a9e2 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -90,6 +90,7 @@ public: , receivedExpose(false) , positionPolicy(WindowFrameExclusive) , positionAutomatic(true) + , resizeAutomatic(true) , contentOrientation(Qt::PrimaryOrientation) , opacity(qreal(1.0)) , minimumSize(0, 0) @@ -155,6 +156,8 @@ public: virtual void processSafeAreaMarginsChanged() {}; bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; } + void setAutomaticPositionAndResizeEnabled(bool a) + { positionAutomatic = resizeAutomatic = a; } static QWindowPrivate *get(QWindow *window) { return window->d_func(); } @@ -178,6 +181,7 @@ public: bool receivedExpose; PositionPolicy positionPolicy; bool positionAutomatic; + bool resizeAutomatic; Qt::ScreenOrientation contentOrientation; qreal opacity; QRegion mask; |