6import QGroundControl.Controls
8// We implement our own TabButton to get around the fact that QtQuick.Controls TabBar does not
9// support hiding tabs. This version supports hiding tabs by setting the visible property
10// on the QGCTabButton instances.
13 Layout.fillWidth: true
14 topPadding: _verticalPadding
15 bottomPadding: _verticalPadding
16 leftPadding: _horizontalPadding
17 rightPadding: _horizontalPadding
18 focusPolicy: Qt.ClickFocus
21 property bool primary: false ///< primary button for a group of buttons
22 property real pointSize: ScreenTools.defaultFontPointSize ///< Point size for button text
23 property bool showBorder: qgcPal.globalTheme === QGCPalette.Light
24 property real backRadius: ScreenTools.defaultBorderRadius
25 property real heightFactor: 0.5
27 property bool _showSeparator: false
28 property bool _showHighlight: enabled && (pressed | checked)
29 property int _horizontalPadding: ScreenTools.defaultFontPixelWidth
30 property int _verticalPadding: Math.round(ScreenTools.defaultFontPixelHeight * heightFactor)
31 property bool _showIcon: control.icon.source != ""
33 QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
35 background: Rectangle {
37 implicitWidth: ScreenTools.implicitButtonWidth
38 implicitHeight: ScreenTools.implicitButtonHeight
40 border.width: showBorder ? 1 : 0
41 border.color: qgcPal.buttonBorder
42 color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button
45 anchors.right: parent.right
46 anchors.top: parent.top
47 anchors.bottom: parent.bottom
48 anchors.topMargin: _vertMargin
49 anchors.bottomMargin: _vertMargin
51 color: Qt.darker(qgcPal.buttonText, 1.5)
52 visible: control._showSeparator
54 property real _vertMargin: ScreenTools.defaultFontPixelHeight * 0.25
59 implicitWidth: _showIcon ? icon.width : text.implicitWidth
60 implicitHeight: _showIcon ? icon.height : text.implicitHeight
61 baselineOffset: text.y + text.baselineOffset
65 anchors.centerIn: parent
66 source: control.icon.source
67 height: source === "" ? 0 : ScreenTools.defaultFontPixelHeight
69 color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
70 fillMode: Image.PreserveAspectFit
71 sourceSize.height: height
77 anchors.centerIn: parent
80 font.pointSize: control.pointSize
81 font.family: ScreenTools.normalFontFamily
82 color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText