6import QGroundControl.Controls
7import QGroundControl.FactControls
9/// Controt that allows the user to select from a list of controls to display.
10/// Selection is is shown on right-click for desktop and long press for mobile.
17 topPadding: _showSelectionUI ? selectionUILayout.height : 0
22 property Fact selectedControl ///< Fact which has enumStrings/Values where values are the qml file for the control
23 property bool selectionUIRightAnchor: false
24 property var innerControl: loader.item
26 property bool _showSelectionUI: false
31 anchors.right: control.selectionUIRightAnchor ? parent.right : undefined
32 spacing: ScreenTools.defaultFontPixelWidth
33 visible: _showSelectionUI
36 onClicked: _showSelectionUI = false
37 iconSource: "qrc:/InstrumentValueIcons/lock-open.svg"
49 implicitWidth: loader.item.width
50 implicitHeight: loader.item.height
54 source: selectedControl ? selectedControl.rawValue : ""
59 acceptedButtons: Qt.LeftButton | Qt.RightButton
61 onClicked: (mouse) => {
62 if (!ScreenTools.isMobile && mouse.button === Qt.RightButton) {
63 _showSelectionUI = true
67 onPressAndHold: _showSelectionUI = true