Merge PR #645: Fix webview clipping on OSX

This commit is contained in:
Jenkins nymea 2021-08-18 15:12:19 +02:00
commit 47a26e6f41
2 changed files with 9 additions and 5 deletions

View File

@ -129,13 +129,11 @@ Item {
target: loader.item
property: "bottomClip"
value: loader.bottomClip
when: ["android", "ios"].indexOf(Qt.platform.os) >= 0
}
Binding {
target: loader.item
property: "topClip"
value: loader.topClip
when: ["android", "ios"].indexOf(Qt.platform.os) >= 0
}
Connections {
target: loader.item

View File

@ -64,10 +64,16 @@ DashboardDelegateBase {
}
}
property bool needsHack: ["android", "ios"].indexOf(Qt.platform.os) >= 0
// Some platforms cannot embed webviews inside an app. In those cases, a platform native
// Browser will be overlaid on top of the app. As we can't draw on top of that, we'll need to be
// clever in resizing and hding...
property bool needsHack: ["android", "ios", "osx"].indexOf(Qt.platform.os) >= 0
property bool webViewVisible: !needsHack ||
(!app.mainMenu.visible && !root.editMode && root.topClip < root.height && root.bottomClip < height && !pageStack.busy)
property int topClip: needsHack ? root.topClip : 0
property int bottomClip: needsHack ? root.bottomClip : 0
property string webViewString:
'
import QtQuick 2.8;
@ -77,8 +83,8 @@ DashboardDelegateBase {
WebView {
id: webView
anchors.fill: parent
anchors.bottomMargin: root.bottomClip + Style.smallMargins
anchors.topMargin: root.topClip + Style.smallMargins
anchors.bottomMargin: delegateRoot.bottomClip + Style.smallMargins
anchors.topMargin: delegateRoot.topClip + Style.smallMargins
url: root.item.url
enabled: root.item.interactive
visible: delegateRoot.webViewVisible