FlyViewTool Plugin¶
FlyViewTool is a minimal plugin that demonstrates the flyviewtsbutton hook. It adds a single circular button to the FlyView tool strip; clicking it opens a popup. There is no data singleton, no settings panel, and no menu integration — just the button.
What it does¶
- Adds a circular "H" button to the FlyView tool strip.
- Opens a popup with a greeting message when clicked.
- Is always visible (no conditional visibility logic).
File structure¶
FlyViewTool/
├── plugin.json
├── build.sh
├── src/
│ ├── MyFlyViewTSButton.qml ← flyviewtsbutton hook
│ └── HelloPopup.qml ← popup dialog
└── img/
└── hello.svg ← toolbar icon
plugin.json¶
{
"name": "FlyViewTool",
"description": "Minimal example of the flyviewtsbutton hook — adds a button to the FlyView tool strip",
"author": "Auterion",
"copyright": "(c) 2026 Auterion AG",
"license": "MIT",
"type": "qml"
}
MyFlyViewTSButton.qml¶
AMC detects the flyviewtsbutton keyword in the filename and loads it into the tool strip.
Key patterns demonstrated:
QGCHoverButtonwithradius: height / 2for a circular button matching the toolbar styleproperty string namewrapped inqsTr()— when non-empty, renders a label to the right of the button when the user has label visibility enabled via the tool strip's expand button- the global
qgcPalfor theme-aware colors HelloPopupas a separate QML file, instantiated inline and opened on click
import QtQuick
import QtQuick.Controls
import QGroundControl.Controls
import QGroundControl.Palette
import QGroundControl.ScreenTools
// Filename contains "flyviewtsbutton" — AMC loads this as a FlyViewTSButton hook.
// The host sets width and height to ScreenTools.defaultButtonSize.
QGCHoverButton {
flat: false
radius: height / 2
backgroundColor: qgcPal.windowShadeDark
disabledBackgroundColor: qgcPal.windowShadeDark
imageSource: Qt.resolvedUrl("../img/hello.svg")
property string name: qsTr("Show Greeting")
onClicked: helloPopup.open()
HelloPopup { id: helloPopup }
}
HelloPopup.qml¶
The popup dialog, kept in its own file to separate presentation from the button logic.
import QtQuick
import QtQuick.Controls
import QGroundControl.Controls
import QGroundControl.Palette
import QGroundControl.ScreenTools
Popup {
anchors.centerIn: Overlay.overlay
modal: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
padding: ScreenTools.defaultFontPixelWidth * 2
background: Rectangle {
color: qgcPal.window
radius: ScreenTools.defaultFontPixelWidth
}
QGCLabel {
text: qsTr("Hello from FlyViewTool!")
font.pointSize: ScreenTools.largeFontPointSize
font.bold: true
}
}
Building and installing¶
This produces FlyViewTool.plugin. Copy it to the AMC Plugins folder:
AMC loads plugins at startup and watches the folder for changes — no restart needed when adding or removing a plugin file.
Next steps¶
- Add a Data singleton to persist state across sessions.
- Add a Settings panel to let the user configure the plugin.
- See the FlyViewTSButton hook reference for the full API.