From 9ee954200844f27f62abf2b5566ccf16a49ad4f6 Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Sat, 27 Jul 2019 13:56:08 -0400 Subject: [PATCH] Custom multi vehicle indicators/selectors --- custom-example/res/Custom/Widgets/CustomVehicleButton.qml | 6 +++--- custom-example/res/CustomFlyView.qml | 5 ++++- custom-example/src/CustomPlugin.cc | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/custom-example/res/Custom/Widgets/CustomVehicleButton.qml b/custom-example/res/Custom/Widgets/CustomVehicleButton.qml index bc1d9609e..698d1be01 100644 --- a/custom-example/res/Custom/Widgets/CustomVehicleButton.qml +++ b/custom-example/res/Custom/Widgets/CustomVehicleButton.qml @@ -61,7 +61,7 @@ Button { width: height sourceSize.height: parent.height fillMode: Image.PreserveAspectFit - color: qgcPal.buttonText + color: button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText source: "/qmlimages/PaperPlane.svg" anchors.verticalCenter: parent.verticalCenter } @@ -71,13 +71,13 @@ Button { QGCLabel { text: qsTr("Vehicle ") + (vehicle ? vehicle.id : qsTr("None")) font.family: ScreenTools.demiboldFontFamily - color: qgcPal.buttonText + color: button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText } Row { spacing: ScreenTools.defaultFontPixelWidth QGCLabel { text: vehicle ? vehicle.flightMode : qsTr("None") - color: qgcPal.buttonText + color: button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText } Rectangle { height: ScreenTools.defaultFontPixelHeight * 0.5 diff --git a/custom-example/res/CustomFlyView.qml b/custom-example/res/CustomFlyView.qml index 80ec26b83..936159cd7 100644 --- a/custom-example/res/CustomFlyView.qml +++ b/custom-example/res/CustomFlyView.qml @@ -491,7 +491,7 @@ Item { id: multiVehicleSelector spacing: ScreenTools.defaultFontPixelWidth anchors.bottom: parent.bottom - anchors.bottomMargin: ScreenTools.defaultFontPixelWidth + anchors.bottomMargin: ScreenTools.defaultFontPixelWidth * 1.5 anchors.right: parent.right anchors.rightMargin: ScreenTools.defaultFontPixelWidth visible: QGroundControl.multiVehicleManager.vehicles.count > 1 @@ -501,6 +501,9 @@ Item { property var _vehicle: QGroundControl.multiVehicleManager.vehicles.get(modelData) vehicle: _vehicle checked: (_vehicle && activeVehicle) ? _vehicle.id === activeVehicle.id : false + onClicked: { + QGroundControl.multiVehicleManager.activeVehicle = _vehicle + } } } } diff --git a/custom-example/src/CustomPlugin.cc b/custom-example/src/CustomPlugin.cc index 7d7063141..d09e09f68 100644 --- a/custom-example/src/CustomPlugin.cc +++ b/custom-example/src/CustomPlugin.cc @@ -281,7 +281,7 @@ CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#9d9d9d"); } else if (colorName == QStringLiteral("buttonHighlight")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#6EF880"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#F3BC5E"); colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#222a35"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#edcfb4"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#e4e4e4"); @@ -299,9 +299,9 @@ CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#585858"); } else if (colorName == QStringLiteral("primaryButtonText")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#ffffff"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#29313A"); colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#777c89"); - colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#ffffff"); + colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#29313A"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#cad0d0"); } else if (colorName == QStringLiteral("textField")) { -- 2.22.0