diff options
author | Andy Shaw <andy.shaw@qt.io> | 2021-01-13 15:52:48 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2021-01-14 13:47:33 +0100 |
commit | c4cd14a0e8d199669554824ce917ad0db31373ce (patch) | |
tree | b7cc1f08b4040960572b5cf10e9ed24449bf9c8e /src | |
parent | 8e82991875c82916785823ba01a02614b04369de (diff) |
Sync with window visibilty due to offscreen windows in use
When there is an offscreen window used then this is always not visible,
but visiblityChanged is still emitted in this case and can be
relied upon. So we check if this is set to QWindow::Hidden and make
the webview visible/hidden accordingly.
Pick-to: 5.15
Change-Id: I95892ef5df8b03feb282b49c8979ae6c93e18a87
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/webview/qquickviewcontroller.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/webview/qquickviewcontroller.cpp b/src/webview/qquickviewcontroller.cpp index 35e2450..775dceb 100644 --- a/src/webview/qquickviewcontroller.cpp +++ b/src/webview/qquickviewcontroller.cpp @@ -260,7 +260,9 @@ void QQuickViewController::onWindowChanged(QQuickWindow* window) connect(window, &QWindow::yChanged, this, &QQuickViewController::scheduleUpdatePolish); connect(window, &QQuickWindow::sceneGraphInitialized, this, &QQuickViewController::scheduleUpdatePolish); connect(window, &QQuickWindow::sceneGraphInvalidated, this, &QQuickViewController::onSceneGraphInvalidated); - connect(window, &QWindow::visibleChanged, this, [this](bool visible) { m_view->setVisible(visible); }); + connect(window, &QWindow::visibilityChanged, this, [this](QWindow::Visibility visibility) + { m_view->setVisible(visibility != QWindow::Hidden); }); + m_view->setVisible(window->visibility() != QWindow::Hidden); m_view->setParentView(window); } } |