1/MainRootWindow.qml 相应位置添加如下代码
function showMyAddView() {
viewSwitch(false)
myAddWindow.visible = true
}
Loader {
id: myAddWindow
anchors.fill: parent
visible: false
//source: “MyAddView.qml”
source: “MyAddBackground2.qml”
}
2/ 编写 MyAddBackground2.qml 添加到资源库 qgroundcontrol,qrc
3/MainToolBar.qml 添加如下代码:
QGCToolBarButton {
id: myAddButton
Layout.fillHeight: true
icon.source: “/qmlimages/Analyze.svg”
// icon.source: “/qmlimages/Plan.svg”
visible: QGroundControl.corePlugin.showAdvancedUI
onClicked: {
if (mainWindow.preventViewSwitch()) {
return
}
buttonRow.clearAllChecks()
checked = true
mainWindow.showMyAddView()
//mainWindow.showAnalyzeView()
//showMyAddView
}
}