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 _showHighlight: enabled && (pressed | checked)
28 property int _horizontalPadding: ScreenTools.defaultFontPixelWidth
29 property int _verticalPadding: Math.round(ScreenTools.defaultFontPixelHeight * heightFactor)
30 property bool _showIcon: control.icon.source != ""
32 QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
34 background: Rectangle {
36 implicitWidth: ScreenTools.implicitButtonWidth
37 implicitHeight: ScreenTools.implicitButtonHeight
39 border.width: showBorder ? 1 : 0
40 border.color: qgcPal.buttonBorder
41 color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button
45 implicitWidth: _showIcon ? icon.width : text.implicitWidth
46 implicitHeight: _showIcon ? icon.height : text.implicitHeight
47 baselineOffset: text.y + text.baselineOffset
51 anchors.centerIn: parent
52 source: control.icon.source
53 height: source === "" ? 0 : ScreenTools.defaultFontPixelHeight
55 color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
56 fillMode: Image.PreserveAspectFit
57 sourceSize.height: height
63 anchors.centerIn: parent
66 font.pointSize: control.pointSize
67 font.family: ScreenTools.normalFontFamily
68 color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText