mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 01:53:10 +02:00
Merge pull request #7143 from imgntn/webengine-new-windows
Add support for pop-up windows to Qt WebEngineView
This commit is contained in:
commit
342391cb2f
3 changed files with 20 additions and 11 deletions
|
@ -14,7 +14,8 @@ Window {
|
||||||
destroyOnInvisible: true
|
destroyOnInvisible: true
|
||||||
width: 800
|
width: 800
|
||||||
height: 600
|
height: 600
|
||||||
|
property alias webView: webview
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
visible = true
|
visible = true
|
||||||
addressBar.text = webview.url
|
addressBar.text = webview.url
|
||||||
|
@ -28,6 +29,7 @@ Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id:item
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -125,12 +127,10 @@ Window {
|
||||||
console.log("New icon: " + icon)
|
console.log("New icon: " + icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
profile: WebEngineProfile {
|
profile: desktop.browserProfile
|
||||||
id: webviewProfile
|
|
||||||
storageName: "qmlUserBrowser"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // item
|
} // item
|
||||||
|
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
|
|
|
@ -53,9 +53,12 @@ WebEngineView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
profile: WebEngineProfile {
|
onNewViewRequested:{
|
||||||
id: webviewProfile
|
var component = Qt.createComponent("../Browser.qml");
|
||||||
httpUserAgent: "Mozilla/5.0 (HighFidelityInterface)"
|
var newWindow = component.createObject(desktop);
|
||||||
storageName: "qmlWebEngine"
|
request.openIn(newWindow.webView)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
profile: desktop.browserProfile
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ Desktop {
|
||||||
id: desktop
|
id: desktop
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
WebEngine.settings.javascriptCanOpenWindows = false;
|
WebEngine.settings.javascriptCanOpenWindows = true;
|
||||||
WebEngine.settings.javascriptCanAccessClipboard = false;
|
WebEngine.settings.javascriptCanAccessClipboard = false;
|
||||||
WebEngine.settings.spatialNavigationEnabled = true;
|
WebEngine.settings.spatialNavigationEnabled = true;
|
||||||
WebEngine.settings.localContentCanAccessRemoteUrls = true;
|
WebEngine.settings.localContentCanAccessRemoteUrls = true;
|
||||||
|
@ -19,6 +19,12 @@ Desktop {
|
||||||
property alias toolWindow: toolWindow
|
property alias toolWindow: toolWindow
|
||||||
ToolWindow { id: toolWindow }
|
ToolWindow { id: toolWindow }
|
||||||
|
|
||||||
|
property var browserProfile: WebEngineProfile {
|
||||||
|
id: webviewProfile
|
||||||
|
httpUserAgent: "Chrome/48.0 (HighFidelityInterface)"
|
||||||
|
storageName: "qmlWebEngine"
|
||||||
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
text: "Open Browser"
|
text: "Open Browser"
|
||||||
shortcut: "Ctrl+B"
|
shortcut: "Ctrl+B"
|
||||||
|
|
Loading…
Reference in a new issue