FluentUI/Gallery/res/qml/component/MapContainer.qml
yxdy ff15075c79
Some checks are pending
Gallery App Build / macOS (push) Waiting to run
Gallery App Build / Windows (push) Waiting to run
Gallery App Build / Ubuntu (push) Waiting to run
修改样式
2025-03-07 16:23:09 +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://localhost:8077/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)
}
}