5import QGroundControl.Controls
7/// Column of tab pills, styled like QGCGroupBox header buttons. Pills show vertical text when there is room and icons
8/// otherwise. The right side of each pill is padding meant to sit under the panel it is attached to.
12 property var model: [] ///< Entries from PlanPanelLogic.tabModel()
13 property string currentTab
14 property string style: "icon" ///< "text" or "icon"
16 signal tabClicked(string tab)
18 readonly property bool _textStyle: style === "text"
19 readonly property var _icons: ({
20 "plan": "/qmlimages/Plan.svg",
21 "mission": "/res/waypoint.svg",
22 "fence": "/res/GeoFence.svg",
23 "rally": "/res/RallyPoint.svg"
25 readonly property var _labels: ({
27 "mission": qsTr("Mission"),
28 "fence": qsTr("Fence"),
29 "rally": qsTr("Rally")
32 spacing: ScreenTools.defaultFontPixelWidth / 2
40 required property var modelData
42 readonly property bool current: modelData.id === root.currentTab
44 objectName: "planPanel_tab_" + modelData.id
45 text: root._labels[modelData.id]
46 enabled: modelData.enabled
47 implicitWidth: ScreenTools.defaultFontPixelHeight * 2.2
48 implicitHeight: root._textStyle ? ScreenTools.defaultFontPixelHeight * 1.5 + tabText.implicitWidth : ScreenTools.defaultFontPixelHeight * 2.6
49 rightPadding: ScreenTools.defaultBorderRadius * 2
50 hoverEnabled: !ScreenTools.isMobile
51 focusPolicy: Qt.ClickFocus
55 onClicked: root.tabClicked(modelData.id)
57 QGCPalette { id: pillPal; colorGroupEnabled: pill.enabled }
59 background: Rectangle {
60 radius: ScreenTools.defaultBorderRadius
61 color: pill.current ? pillPal.accentSubtle : pillPal.windowPanel
63 border.color: pill.current || pill.hovered || pill.pressed ? pillPal.accent : pillPal.borderSubtle
68 anchors.centerIn: parent
69 width: ScreenTools.defaultFontPixelHeight
71 visible: !root._textStyle
72 source: root._icons[pill.modelData.id]
73 color: pillPal.textPrimary
74 fillMode: Image.PreserveAspectFit
75 sourceSize.height: height
80 anchors.centerIn: parent
82 visible: root._textStyle
84 color: pillPal.textPrimary
88 // Warning dot at the top-left corner of the pill, overlapping the icon or the end of the text a little
92 readonly property real margin: ScreenTools.defaultFontPixelHeight * 0.25
94 objectName: "planPanel_tabBadge_" + pill.modelData.id
98 width: ScreenTools.defaultFontPixelHeight * 0.6
101 visible: pill.modelData.warn
102 color: pillPal.colorOrange