From 1cfc3736c38e1e65bc6e2a32f76938f6f223459c Mon Sep 17 00:00:00 2001 From: Zdanek Date: Fri, 22 Sep 2023 14:12:26 +0200 Subject: [PATCH] Set instrument Value have custom color as label Fix instrument panel and editor layout --- src/QmlControls/InstrumentValueEditDialog.qml | 12 +++++++++--- src/QmlControls/InstrumentValueLabel.qml | 6 +++--- src/QmlControls/InstrumentValueValue.qml | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/QmlControls/InstrumentValueEditDialog.qml b/src/QmlControls/InstrumentValueEditDialog.qml index 6f3e37a..7d45d9f 100644 --- a/src/QmlControls/InstrumentValueEditDialog.qml +++ b/src/QmlControls/InstrumentValueEditDialog.qml @@ -192,13 +192,19 @@ QGCPopupDialog { case InstrumentValueData.OpacityRange: sourceComponent = opacityRangeDialog break - case InstrumentValueData.IconSelvalueedectRange: + case InstrumentValueData.IconSelectRange: sourceComponent = iconRangeDialog break } } - Component.onCompleted: updateSourceComponent() + Component.onCompleted: { + updateSourceComponent() + if (sourceComponent) { + height = item.childrenRect.height + width = item.childrenRect.width + } + } Connections { target: instrumentValueData @@ -329,7 +335,7 @@ QGCPopupDialog { id: iconRangeDialog Item { - width: childrenRect.widthvalueed + width: childrenRect.width height: childrenRect.height function updateRangeValue(index, text) { diff --git a/src/QmlControls/InstrumentValueLabel.qml b/src/QmlControls/InstrumentValueLabel.qml index 7ec8b37..99e09c7 100644 --- a/src/QmlControls/InstrumentValueLabel.qml +++ b/src/QmlControls/InstrumentValueLabel.qml @@ -36,7 +36,7 @@ ColumnLayout { id: valueIcon Layout.alignment: _verticalOrientation ? Qt.AlignHCenter : Qt.AlignVCenter height: _tightHeight * 0.75 - width: height + width: _tightHeight * 0.85 sourceSize.height: height fillMode: Image.PreserveAspectFit mipmap: true @@ -50,9 +50,9 @@ ColumnLayout { function updateIcon() { if (instrumentValueData.rangeType === InstrumentValueData.IconSelectRange) { - valueIcon.source = iconPrefix + instrumentValueData.currentIcon + valueIcon.source = instrumentValueData.currentIcon != "" ? iconPrefix + instrumentValueData.currentIcon : ""; } else if (instrumentValueData.icon) { - valueIcon.source = iconPrefix + instrumentValueData.icon + valueIcon.source = instrumentValueData.icon != "" ? iconPrefix + instrumentValueData.icon : ""; } else { valueIcon.source = "" } diff --git a/src/QmlControls/InstrumentValueValue.qml b/src/QmlControls/InstrumentValueValue.qml index 2d8e107..7b2a330 100644 --- a/src/QmlControls/InstrumentValueValue.qml +++ b/src/QmlControls/InstrumentValueValue.qml @@ -38,6 +38,7 @@ ColumnLayout { id: label Layout.alignment: Qt.AlignVCenter font.pointSize: _fontSize + color: instrumentValueData.isValidColor(instrumentValueData.currentColor) ? instrumentValueData.currentColor : qgcPal.text text: valueText() function valueText() {