diff options
author | Szabolcs David <davidsz@inf.u-szeged.hu> | 2015-03-30 05:58:20 -0700 |
---|---|---|
committer | Szabolcs David <davidsz@inf.u-szeged.hu> | 2015-05-07 12:23:13 +0000 |
commit | 76a990cfa3409214530e77d132cdefd9e96685f9 (patch) | |
tree | 7d62ab06ba35446d0ba56a30fe6d3e93362a7cc6 /examples/webengine/quicknanobrowser/ApplicationRoot.qml | |
parent | 8596813a10b66b539746bb890bd4304e5f65b348 (diff) |
Quick: Share profiles between application windows
The applications should not create new WebEngineProfiles for
each window, because the WebEngineView can not adopt content
from a different profile when the target of the NewViewRequest
is a new window (SHIFT+click) or a dialog.
This also adds a notifier signal to the profile property
in order to avoid "non-NOTIFYable" warnings.
Change-Id: I235789f9bfa1a216f99592204e50266242d0ef1c
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'examples/webengine/quicknanobrowser/ApplicationRoot.qml')
-rw-r--r-- | examples/webengine/quicknanobrowser/ApplicationRoot.qml | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/examples/webengine/quicknanobrowser/ApplicationRoot.qml b/examples/webengine/quicknanobrowser/ApplicationRoot.qml index b16ee0078..b409696be 100644 --- a/examples/webengine/quicknanobrowser/ApplicationRoot.qml +++ b/examples/webengine/quicknanobrowser/ApplicationRoot.qml @@ -39,9 +39,19 @@ ****************************************************************************/ import QtQuick 2.1 +import QtWebEngine 1.1 QtObject { id: root + + property QtObject defaultProfile: WebEngineProfile { + storageName: "Default" + } + + property QtObject otrProfile: WebEngineProfile { + offTheRecord: true + } + property Component browserWindowComponent: BrowserWindow { applicationRoot: root onClosing: destroy() @@ -49,10 +59,19 @@ QtObject { property Component browserDialogComponent: BrowserDialog { onClosing: destroy() } - function createWindow() { return browserWindowComponent.createObject(root) } - function createDialog() { return browserDialogComponent.createObject(root) } + function createWindow(profile) { + var newWindow = browserWindowComponent.createObject(root) + newWindow.currentWebView.profile = profile + profile.downloadRequested.connect(newWindow.onDownloadRequested) + return newWindow + } + function createDialog(profile) { + var newDialog = browserDialogComponent.createObject(root) + newDialog.currentWebView.profile = profile + return newDialog + } function load(url) { - var browserWindow = createWindow() + var browserWindow = createWindow(defaultProfile) browserWindow.currentWebView.url = url } } |