summaryrefslogtreecommitdiffstats
path: root/tests/quicktestbrowser/BrowserWindow.qml
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2015-01-15 15:45:46 +0100
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2015-01-23 12:10:48 +0100
commita9cae7c25c67dfc21f63202a9fadba8ad20d24df (patch)
treea00e3383c70ec8086950744b377c1857f6d1f483 /tests/quicktestbrowser/BrowserWindow.qml
parent5d1883372fe107f70a39c9cea13f584a8cc61e0b (diff)
Fix the new window example code GC problems
If we want to allow destroying the main window, we need to also create it dynamically. Use an intermediate root QtObject to take care of this. Change-Id: I04ba2ac7b1a24ea75ee1eecc3ab9157e8645ab30 Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'tests/quicktestbrowser/BrowserWindow.qml')
-rw-r--r--tests/quicktestbrowser/BrowserWindow.qml23
1 files changed, 4 insertions, 19 deletions
diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml
index d840ac7d0..98156eeb4 100644
--- a/tests/quicktestbrowser/BrowserWindow.qml
+++ b/tests/quicktestbrowser/BrowserWindow.qml
@@ -52,7 +52,7 @@ import Qt.labs.settings 1.0
ApplicationWindow {
id: browserWindow
- function load(url) { currentWebView.url = url }
+ property QtObject applicationRoot
property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item.webView : null
property bool isFullScreen: visibility == Window.FullScreen
@@ -305,20 +305,6 @@ ApplicationWindow {
Component.onCompleted: createEmptyTab()
Component {
- id: dialogComponent
- Window {
- property Item webView: _webView
- width: 800
- height: 600
- visible: true
- WebEngineView {
- id: _webView
- anchors.fill: parent
- }
- }
- }
-
- Component {
id: tabComponent
Item {
property alias webView: webEngineView
@@ -388,11 +374,10 @@ ApplicationWindow {
var tab = tabs.createEmptyTab()
request.openIn(tab.item.webView)
} else if (request.destination == WebEngineView.NewViewInDialog) {
- var dialog = dialogComponent.createObject(webEngineView)
- request.openIn(dialog.webView)
+ var dialog = applicationRoot.createDialog()
+ request.openIn(dialog.currentWebView)
} else {
- var component = Qt.createComponent("quickwindow.qml")
- var window = component.createObject()
+ var window = applicationRoot.createWindow()
request.openIn(window.currentWebView)
}
}