mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
1st experimental approach
This commit is contained in:
parent
42f6333948
commit
56dedea66c
3 changed files with 279 additions and 208 deletions
|
@ -1,5 +1,5 @@
|
|||
import QtQuick 2.5
|
||||
import QtWebEngine 1.1
|
||||
import QtQuick 2.7
|
||||
import QtWebEngine 1.5
|
||||
import QtWebChannel 1.0
|
||||
import "../controls-uit" as HiFiControls
|
||||
|
||||
|
@ -23,14 +23,18 @@ Item {
|
|||
|
||||
property alias viewProfile: root.profile
|
||||
|
||||
WebEngineView {
|
||||
id: root
|
||||
objectName: "webEngineView"
|
||||
Flickable {
|
||||
id: flick
|
||||
x: 0
|
||||
y: 0
|
||||
width: parent.width
|
||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
||||
|
||||
WebEngineView {
|
||||
id: root
|
||||
objectName: "webEngineView"
|
||||
anchors.fill: parent
|
||||
|
||||
profile: HFWebEngineProfile;
|
||||
|
||||
property string userScriptUrl: ""
|
||||
|
@ -65,6 +69,11 @@ Item {
|
|||
|
||||
property string newUrl: ""
|
||||
|
||||
onContentsSizeChanged: {
|
||||
console.log("WebView contentsSize", contentsSize)
|
||||
flick.contentWidth = Math.max(contentsSize.width, flick.width)
|
||||
flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
webChannel.registerObject("eventBridge", eventBridge);
|
||||
|
@ -82,12 +91,15 @@ Item {
|
|||
}
|
||||
|
||||
onLoadingChanged: {
|
||||
console.log("loading changed", loadRequest.status)
|
||||
keyboardRaised = false;
|
||||
punctuationMode = false;
|
||||
keyboard.resetShiftMode(false);
|
||||
|
||||
// Required to support clicking on "hifi://" links
|
||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||
flick.contentWidth = -1
|
||||
flick.contentHeight = -1
|
||||
var url = loadRequest.url.toString();
|
||||
url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
|
||||
if (urlHandler.canHandleUrl(url)) {
|
||||
|
@ -96,6 +108,26 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
||||
// flick.contentWidth = Math.max(contentsSize.width, flick.width)
|
||||
// flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
||||
root.runJavaScript(
|
||||
"document.body.scrollHeight;",
|
||||
function (i_actualPageHeight) {
|
||||
console.log("on reloaded documentElement.scrollHeigh:", i_actualPageHeight)
|
||||
// flick.contentHeight = Math.max (
|
||||
// i_actualPageHeight, flick.height);
|
||||
})
|
||||
root.runJavaScript(
|
||||
"document.body.scrollWidth;",
|
||||
function (i_actualPageWidth) {
|
||||
console.log("on reloaded documentElement.scrollWidth:", i_actualPageWidth)
|
||||
|
||||
// flick.contentWidth = Math.max (
|
||||
// i_actualPageWidth, flick.width);
|
||||
})
|
||||
console.log("on reloaded content size:", contentsSize)
|
||||
}
|
||||
}
|
||||
|
||||
onNewViewRequested:{
|
||||
|
@ -109,6 +141,7 @@ Item {
|
|||
|
||||
HiFiControls.WebSpinner { }
|
||||
}
|
||||
}
|
||||
|
||||
HiFiControls.Keyboard {
|
||||
id: keyboard
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import QtQuick 2.5
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtWebEngine 1.2
|
||||
import QtWebEngine 1.5
|
||||
import QtWebChannel 1.0
|
||||
import "../controls-uit" as HiFiControls
|
||||
import "../styles" as HifiStyles
|
||||
|
@ -136,14 +136,19 @@ Item {
|
|||
loadUrl(url);
|
||||
}
|
||||
|
||||
WebEngineView {
|
||||
id: webview
|
||||
objectName: "webEngineView"
|
||||
Flickable {
|
||||
id: flick
|
||||
x: 0
|
||||
y: 0
|
||||
width: parent.width
|
||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height - web.headerHeight : parent.height - web.headerHeight
|
||||
anchors.top: buttons.bottom
|
||||
|
||||
WebEngineView {
|
||||
id: webview
|
||||
objectName: "webEngineView"
|
||||
anchors.fill: parent
|
||||
|
||||
profile: HFWebEngineProfile;
|
||||
|
||||
property string userScriptUrl: ""
|
||||
|
@ -220,6 +225,8 @@ Item {
|
|||
}
|
||||
|
||||
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
||||
flick.contentWidth = Math.max(contentsSize.width, flick.width)
|
||||
flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
||||
webview.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
@ -230,6 +237,7 @@ Item {
|
|||
|
||||
HiFiControls.WebSpinner { }
|
||||
}
|
||||
}
|
||||
|
||||
HiFiControls.Keyboard {
|
||||
id: keyboard
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import QtQuick 2.5
|
||||
import QtWebEngine 1.1
|
||||
import QtQuick 2.7
|
||||
import QtWebEngine 1.5
|
||||
import QtWebChannel 1.0
|
||||
import "../controls-uit" as HiFiControls
|
||||
|
||||
|
@ -23,14 +23,19 @@ Item {
|
|||
|
||||
property alias viewProfile: root.profile
|
||||
|
||||
WebEngineView {
|
||||
id: root
|
||||
objectName: "webEngineView"
|
||||
Flickable {
|
||||
id: flick
|
||||
x: 0
|
||||
y: 0
|
||||
width: parent.width
|
||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
||||
|
||||
|
||||
WebEngineView {
|
||||
id: root
|
||||
objectName: "webEngineView"
|
||||
anchors.fill: parent
|
||||
|
||||
profile: HFWebEngineProfile;
|
||||
|
||||
property string userScriptUrl: ""
|
||||
|
@ -79,6 +84,12 @@ Item {
|
|||
grantFeaturePermission(securityOrigin, feature, true);
|
||||
}
|
||||
|
||||
onContentsSizeChanged: {
|
||||
console.log("WebView contentsSize", contentsSize)
|
||||
flick.contentWidth = Math.max(contentsSize.width, flick.width)
|
||||
flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
||||
}
|
||||
|
||||
onLoadingChanged: {
|
||||
keyboardRaised = false;
|
||||
punctuationMode = false;
|
||||
|
@ -94,6 +105,24 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
||||
|
||||
// flick.contentWidth = Math.max(contentsSize.width, flick.width)
|
||||
// flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
||||
root.runJavaScript(
|
||||
"document.body.scrollHeight;",
|
||||
function (i_actualPageHeight) {
|
||||
flick.contentHeight = Math.max (
|
||||
i_actualPageHeight, flick.height);
|
||||
})
|
||||
root.runJavaScript(
|
||||
"document.body.scrollWidth;",
|
||||
function (i_actualPageWidth) {
|
||||
flick.contentWidth = Math.max (
|
||||
i_actualPageWidth, flick.width);
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
onNewViewRequested:{
|
||||
|
@ -107,6 +136,7 @@ Item {
|
|||
|
||||
HiFiControls.WebSpinner { }
|
||||
}
|
||||
}
|
||||
|
||||
HiFiControls.Keyboard {
|
||||
id: keyboard
|
||||
|
|
Loading…
Reference in a new issue