Browse Source

Set instrument Value have custom color as label

Fix instrument panel and editor layout
QGC4.4
Zdanek 1 year ago committed by Patrick José Pereira
parent
commit
1cfc3736c3
  1. 12
      src/QmlControls/InstrumentValueEditDialog.qml
  2. 6
      src/QmlControls/InstrumentValueLabel.qml
  3. 1
      src/QmlControls/InstrumentValueValue.qml

12
src/QmlControls/InstrumentValueEditDialog.qml

@ -192,13 +192,19 @@ QGCPopupDialog { @@ -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 { @@ -329,7 +335,7 @@ QGCPopupDialog {
id: iconRangeDialog
Item {
width: childrenRect.widthvalueed
width: childrenRect.width
height: childrenRect.height
function updateRangeValue(index, text) {

6
src/QmlControls/InstrumentValueLabel.qml

@ -36,7 +36,7 @@ ColumnLayout { @@ -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 { @@ -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 = ""
}

1
src/QmlControls/InstrumentValueValue.qml

@ -38,6 +38,7 @@ ColumnLayout { @@ -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() {

Loading…
Cancel
Save