FluentUI/Gallery/res/qml/component/MapContainer.qml
yxdy 0d08d59cf1
Some checks failed
Gallery App Build / macOS (push) Has been cancelled
Gallery App Build / Ubuntu (push) Has been cancelled
Gallery App Build / Windows (push) Has been cancelled
修改cmake
2025-03-08 13:34:39 +08:00

76 lines
2.0 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import FluentUI.Controls
import FluentUI.impl
import QtWebEngine
import QtWebChannel
Item {
id: control
signal asyncMapInfo(var item)
anchors.fill: parent
QtObject {
id: qtObject
WebChannel.id: "channelqtObject"
signal signaltest(var test)
function sendToQML(data)
{
control.asyncMapInfo(data)
}
}
WebChannel {
id: myChannel
registeredObjects: [qtObject]
}
ColumnLayout{
spacing: 10
anchors.topMargin: 0
anchors.bottomMargin: 10
anchors.rightMargin: 10
anchors.leftMargin: 0
anchors.fill: parent
implicitHeight: parent.height
// Button{
// text:"Standard Button"
// Layout.fillHeight: false
// onClicked: {
// console.log("click")
// webQues.runJavaScript("js_getBodyHeight()",null)
// }
// }
WebEngineView {
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom
Layout.preferredWidth: 500
Layout.preferredHeight: 60230
id: webQues
url: "http://123.6.102.119:85/maptool/" // http://123.6.102.119:85/
settings.localContentCanAccessRemoteUrls: true
settings.localContentCanAccessFileUrls: false
settings.pluginsEnabled: false
settings.fullScreenSupportEnabled: true
settings.screenCaptureEnabled: false
webChannel: myChannel
onContextMenuRequested: {
request.accepted = true
}
}
}
function run_js(method, params={}) {
var ms = method + '(' + JSON.stringify(params) + ')'
console.log("run......" + ms)
webQues.runJavaScript(ms)
}
}