Skip to content

Globals

These are the global singletons and utilities available to all plugin QML files.


QGroundControl

Import: import QGroundControl

The main application singleton. Provides access to top-level managers and utilities.

Key properties

Property Type Description
multiVehicleManager MultiVehicleManager Manages all connected vehicles
settingsManager SettingsManager Application settings
unitsConversion UnitsConversion Unit conversion utilities

Accessing the active vehicle

import QGroundControl

property var vehicle: QGroundControl.multiVehicleManager.activeVehicle

The activeVehicle is null when no vehicle is connected. Always null-check:

QGCLabel {
    text: vehicle ? vehicle.flightMode : "No vehicle"
}

MultiVehicleManager

AMC can have several vehicles connected at once. multiVehicleManager tracks them all in vehicles; activeVehicle is the one the user currently has selected. Most plugins only care about the active vehicle — bind to activeVehicle and the UI follows the user's selection automatically. Iterate vehicles only if you genuinely need every connected vehicle at once.

Property Type Description
activeVehicle Vehicle* Currently selected vehicle (or null)
vehicles QmlObjectListModel* List of all connected vehicles

Units conversion

The unitsConversion object converts between internal SI units and the user's preferred display units.

Method / Property Returns Description
metersPerSecondToAppSettingsSpeedUnits(mps) double Convert m/s to user's speed units
appSettingsSpeedUnitsString QString User's speed unit label (e.g., "km/h")
celsiusToAppSettingsTemperatureUnits(celsius) double Convert °C to user's temperature units
appSettingsTemperatureUnitsString QString User's temperature unit label (e.g., "°F")

Example: Converting speed

import QGroundControl

QGCLabel {
    property var vehicle: QGroundControl.multiVehicleManager.activeVehicle
    text: {
        if (!vehicle) return "--"
        var converted = QGroundControl.unitsConversion
            .metersPerSecondToAppSettingsSpeedUnits(vehicle.groundSpeed.value)
        return converted.toFixed(1) + " " +
            QGroundControl.unitsConversion.appSettingsSpeedUnitsString
    }
}

SettingsManager

Access application settings through QGroundControl.settingsManager. Each settings group is a sub-object whose properties are Fact objects.

See the full Settings reference for all available groups and their properties.


PluginManager

Import: import QGroundControl.Plugin

The PluginManager singleton is available after importing Plugin. It provides plugin-specific utilities.

Methods

Method Parameters Description
log(message) QString Write a message to the AMC log

Example

import QGroundControl.Plugin

Component.onCompleted: {
    PluginManager.log("My plugin loaded successfully")
}

Logging conventions

  • Always use PluginManager.log(), not console.log(). It routes into the AMC log alongside the rest of the app, so messages are attributable and visible to users diagnosing issues.
  • Keep logging event-based and minimal — log meaningful events (load, state change, errors), not recurring per-frame, per-timer, or per-update noise. Spammy logs bury the signal and hurt performance.
  • Gate any chatty output behind an explicit verbose/debug toggle (e.g. a settings switch) that defaults off, rather than logging verbosely by default.
  • Prefix messages with your plugin name (e.g. "MyPlugin: …") so they're easy to filter.

Plugin module

Import: import QGroundControl.Plugin

This import makes two things available:

  1. PluginManager -- the logging singleton described above.
  2. Your data singleton -- if your plugin has a Data hook file (e.g., MyPluginData.qml), it becomes available as the type MyPluginData after this import.
import QGroundControl.Plugin

QGCLabel {
    text: MyPluginData.currentData
    visible: MyPluginData.enabled
}

ScreenTools

Import: import QGroundControl.ScreenTools

A singleton providing screen-aware sizing and font information. See the dedicated ScreenTools page for the full reference.

Quick reference of the most commonly used properties:

import QGroundControl.ScreenTools

Rectangle {
    width: ScreenTools.defaultFontPixelWidth * 20
    height: ScreenTools.defaultFontPixelHeight * 4

    QGCLabel {
        font.pointSize: ScreenTools.mediumFontPointSize
        font.family: ScreenTools.demiboldFontFamily
    }
}

QGCPalette (qgcPal)

Import: import QGroundControl.Palette

The color palette that adapts to the active theme (indoor vs outdoor). See the dedicated Palette page for the full list of available colors.

qgcPal is available globally — reference it directly, no instantiation needed:

import QGroundControl.Palette

Rectangle {
    color: qgcPal.windowShade
    border.color: qgcPal.colorGreen
}

Standard QML modules

Plugins can use the full set of Qt Quick modules:

Import Use
QtQuick Core QML types (Item, Rectangle, Timer, etc.)
QtQuick.Layouts RowLayout, ColumnLayout, GridLayout
QtQuick.Controls Standard controls (Button, Switch, etc.)
QtCore Persistent settings via Settings {}
QtQml.Models ListModel, ObjectModel
QtQuick.Shapes Vector shapes (Shape, ShapePath)

XMLHttpRequest

Standard JavaScript XMLHttpRequest is available for making HTTP requests:

function fetchData() {
    var xhr = new XMLHttpRequest()
    xhr.onreadystatechange = function() {
        if (xhr.readyState === XMLHttpRequest.DONE) {
            if (xhr.status === 200) {
                var data = JSON.parse(xhr.responseText)
                // process data
            }
        }
    }
    xhr.open("GET", "https://api.example.com/data")
    xhr.send()
}