4import QGroundControl.Controls
6/// Loads the editor QML of a mission item. The editors rely on some sizing properties of the enclosing item for their
7/// layout, which this Loader provides so every host gets the same editor behavior.
11 required property var missionItem ///< null unloads the editor
12 property real availableWidth: 0
14 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
15 readonly property real _innerMargin: 2
16 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
17 readonly property real _editFieldWidth: Math.min(availableWidth - _innerMargin * 2, ScreenTools.defaultFontPixelWidth * 12)
21 setSource(missionItem.editorQml, {
22 missionItem: root.missionItem,
23 availableWidth: Qt.binding(() => root.availableWidth)
30 onMissionItemChanged: _load()
32 // Deliberately not asynchronous. An editor destroyed while still loading warns "Cannot create a component in an
33 // invalid context", which synchronous loading avoids.
34 Component.onCompleted: _load()