Skip to content

Commit

Permalink
Sync with window visibilty due to offscreen windows in use
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
AndyShawQt committed Jan 14, 2021
1 parent 8e82991 commit c4cd14a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/webview/qquickviewcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit c4cd14a

Please sign in to comment.