Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.3.1
-
None
-
3df57f7e550a19cb4450ed3896aa51ddb38c2ed2 def5fef7fbf7fedece54d52188f75a90616599a4
Description
main.cpp
#include <QtQuick> #include <QtGui> #include <QtCore> int main(int argc, char **argv) { QGuiApplication app(argc, argv); QQuickView view; view.setGeometry(100, 100, 400, 400); view.setSource(QUrl::fromLocalFile("main.qml")); view.setResizeMode(QQuickView::SizeRootObjectToView); view.setPersistentOpenGLContext(false); view.setPersistentSceneGraph(false); view.rootContext()->setContextProperty("window", &view); view.show(); app.exec(); }
main.qml
import QtQuick 2.0 import QtWebKit 3.0 import QtQuick.Window 2.0 Item { width: 640 height: 480 WebView { id: webview url: "http://reddit.com" anchors.fill: parent onNavigationRequested: { // detect URL scheme prefix, most likely an external link var schemaRE = /^\w+:/; if (schemaRE.test(request.url)) { request.action = WebView.AcceptRequest; } else { request.action = WebView.IgnoreRequest; // delegate request.url here } } } visible: true Rectangle { width: parent.width height: 100 anchors.bottom: parent.bottom; color: Qt.rgba(1, 0, 1, 0.5); MouseArea { anchors.fill: parent onClicked: { window.visible = false; timer.running = true; } } } Timer { id: timer; running: false repeat: false interval: 2000 onTriggered: { window.visible = true; } } }
Click the pink box to hide the window. This starts a timer which will bring the window back two seconds later. When it comes back, the webview doesn't render anymore.
Attachments
For Gerrit Dashboard: QTBUG-40734 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
95519,5 | Avoid crashing when QtQuick destroys our SG node and GL context | 5.4 | qt/qtwebkit | Status: MERGED | +2 | 0 |
99793,2 | Clear a stray ref on layers when purging GL resources | 5.4.0 | qt/qtwebkit | Status: MERGED | +2 | 0 |