From 4900b60680dc7178c6f0da58ca2e4ccdadc4aedb Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Thu, 18 Jul 2019 15:10:37 -0400 Subject: [PATCH] Forgot to customize TabBar and TabButton --- qgroundcontrol.qrc | 2 ++ src/QmlControls/QGCTabBar.qml | 13 +++++++++++ src/QmlControls/QGCTabButton.qml | 22 +++++++++++++++++++ .../QGroundControl/Controls/qmldir | 2 ++ src/VehicleSetup/JoystickConfig.qml | 10 ++++----- 5 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 src/QmlControls/QGCTabBar.qml create mode 100644 src/QmlControls/QGCTabButton.qml diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 076561bf3..148e3fa81 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -125,6 +125,8 @@ src/QmlControls/QGCRadioButton.qml src/QmlControls/QGCSlider.qml src/QmlControls/QGCSwitch.qml + src/QmlControls/QGCTabBar.qml + src/QmlControls/QGCTabButton.qml src/QmlControls/QGCTextField.qml src/QmlControls/QGCToolBarButton.qml src/QmlControls/QGCViewDialog.qml diff --git a/src/QmlControls/QGCTabBar.qml b/src/QmlControls/QGCTabBar.qml new file mode 100644 index 000000000..e7189fbfc --- /dev/null +++ b/src/QmlControls/QGCTabBar.qml @@ -0,0 +1,13 @@ +import QtQuick 2.11 +import QtQuick.Controls 2.4 + +import QGroundControl 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 + +TabBar { + background: Rectangle { + color: qgcPal.window + } +} diff --git a/src/QmlControls/QGCTabButton.qml b/src/QmlControls/QGCTabButton.qml new file mode 100644 index 000000000..da72e0e28 --- /dev/null +++ b/src/QmlControls/QGCTabButton.qml @@ -0,0 +1,22 @@ +import QtQuick 2.11 +import QtQuick.Controls 2.4 + +import QGroundControl 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 + +TabButton { + id: control + property bool _showHighlight: (pressed | hovered | checked) + background: Rectangle { + color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button + } + contentItem: QGCLabel { + text: control.text + color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } +} diff --git a/src/QmlControls/QGroundControl/Controls/qmldir b/src/QmlControls/QGroundControl/Controls/qmldir index 2d079c676..219191864 100644 --- a/src/QmlControls/QGroundControl/Controls/qmldir +++ b/src/QmlControls/QGroundControl/Controls/qmldir @@ -60,6 +60,8 @@ QGCPipable 1.0 QGCPipable.qml QGCRadioButton 1.0 QGCRadioButton.qml QGCSlider 1.0 QGCSlider.qml QGCSwitch 1.0 QGCSwitch.qml +QGCTabBar 1.0 QGCTabBar.qml +QGCTabButton 1.0 QGCTabButton.qml QGCTextField 1.0 QGCTextField.qml QGCToolBarButton 1.0 QGCToolBarButton.qml QGCViewDialog 1.0 QGCViewDialog.qml diff --git a/src/VehicleSetup/JoystickConfig.qml b/src/VehicleSetup/JoystickConfig.qml index c141ab434..4f3dd9dab 100644 --- a/src/VehicleSetup/JoystickConfig.qml +++ b/src/VehicleSetup/JoystickConfig.qml @@ -58,20 +58,20 @@ SetupPage { id: controller } - TabBar { + QGCTabBar { id: bar width: parent.width anchors.top: parent.top - TabButton { + QGCTabButton { text: qsTr("General") } - TabButton { + QGCTabButton { text: qsTr("Button Assigment") } - TabButton { + QGCTabButton { text: qsTr("Calibration") } - TabButton { + QGCTabButton { text: qsTr("Advanced") } } -- 2.22.0