Popupd support reworked

This commit is contained in:
vladest 2017-10-24 22:04:25 +02:00
parent a33b2986cd
commit 874b9149e7

View file

@ -253,16 +253,44 @@ Rectangle {
height: 2
}
Component {
id: webDialogComponent
Rectangle {
property alias webDialogView: webDialogView
color: "white"
HifiControls.BaseWebView {
id: webEngineView
id: webDialogView
anchors.fill: parent
settings.autoLoadImages: true
settings.javascriptEnabled: true
settings.errorPageEnabled: true
settings.pluginsEnabled: true
settings.fullScreenSupportEnabled: true
settings.autoLoadIconsForPage: true
settings.touchIconsEnabled: true
onWindowCloseRequested: {
webDialog.active = false
webDialog.request = null
}
}
}
}
Item {
width: parent.width;
property real webViewHeight: root.height - loadProgressBar.height - 48 - 4
height: keyboardEnabled && keyboardRaised ? webViewHeight - keyboard.height : webViewHeight
HifiControls.BaseWebView {
id: webEngineView
anchors.fill: parent
focus: true
objectName: "tabletWebEngineView"
url: "http://www.highfidelity.com"
url: "https://www.highfidelity.com"
//profile: HFWebEngineProfile;
@ -329,8 +357,14 @@ Rectangle {
}
onNewViewRequested: {
console.error("new view requested:", request.destination)
if (request.destination == WebEngineView.NewViewInDialog) {
webDialog.request = request
webDialog.active = true
} else {
request.openIn(webEngineView);
}
}
onRenderProcessTerminated: {
var status = "";
@ -349,11 +383,22 @@ Rectangle {
break;
}
print("Render process exited with code " + exitCode + " " + status);
console.error("Render process exited with code " + exitCode + " " + status);
reloadTimer.running = true;
}
onFullScreenRequested: {
console.error("FS requested:", request.destination)
if (request.toggleOn) {
webEngineView.state = "FullScreen";
} else {
webEngineView.state = "";
}
request.accept();
}
onWindowCloseRequested: {
console.error("window close requested:", request.destination)
}
Timer {
@ -364,6 +409,24 @@ Rectangle {
onTriggered: webEngineView.reload()
}
}
Loader {
id: webDialog
property WebEngineNewViewRequest request: null
anchors.fill: parent
anchors.margins: 10
active: false
sourceComponent: webDialogComponent
onStatusChanged: {
if (Loader.Ready === status) {
focus = true
item.webDialogView.profile = webEngineView.profile
request.openIn(item.webDialogView)
}
}
}
}
}