Browse Source

Set instrument Value have custom color as label

Fix instrument panel and editor layout
QGC4.4
Zdanek 2 years 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 {
case InstrumentValueData.OpacityRange: case InstrumentValueData.OpacityRange:
sourceComponent = opacityRangeDialog sourceComponent = opacityRangeDialog
break break
case InstrumentValueData.IconSelvalueedectRange: case InstrumentValueData.IconSelectRange:
sourceComponent = iconRangeDialog sourceComponent = iconRangeDialog
break break
} }
} }
Component.onCompleted: updateSourceComponent() Component.onCompleted: {
updateSourceComponent()
if (sourceComponent) {
height = item.childrenRect.height
width = item.childrenRect.width
}
}
Connections { Connections {
target: instrumentValueData target: instrumentValueData
@ -329,7 +335,7 @@ QGCPopupDialog {
id: iconRangeDialog id: iconRangeDialog
Item { Item {
width: childrenRect.widthvalueed width: childrenRect.width
height: childrenRect.height height: childrenRect.height
function updateRangeValue(index, text) { function updateRangeValue(index, text) {

6
src/QmlControls/InstrumentValueLabel.qml

@ -36,7 +36,7 @@ ColumnLayout {
id: valueIcon id: valueIcon
Layout.alignment: _verticalOrientation ? Qt.AlignHCenter : Qt.AlignVCenter Layout.alignment: _verticalOrientation ? Qt.AlignHCenter : Qt.AlignVCenter
height: _tightHeight * 0.75 height: _tightHeight * 0.75
width: height width: _tightHeight * 0.85
sourceSize.height: height sourceSize.height: height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
mipmap: true mipmap: true
@ -50,9 +50,9 @@ ColumnLayout {
function updateIcon() { function updateIcon() {
if (instrumentValueData.rangeType === InstrumentValueData.IconSelectRange) { if (instrumentValueData.rangeType === InstrumentValueData.IconSelectRange) {
valueIcon.source = iconPrefix + instrumentValueData.currentIcon valueIcon.source = instrumentValueData.currentIcon != "" ? iconPrefix + instrumentValueData.currentIcon : "";
} else if (instrumentValueData.icon) { } else if (instrumentValueData.icon) {
valueIcon.source = iconPrefix + instrumentValueData.icon valueIcon.source = instrumentValueData.icon != "" ? iconPrefix + instrumentValueData.icon : "";
} else { } else {
valueIcon.source = "" valueIcon.source = ""
} }

1
src/QmlControls/InstrumentValueValue.qml

@ -38,6 +38,7 @@ ColumnLayout {
id: label id: label
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
font.pointSize: _fontSize font.pointSize: _fontSize
color: instrumentValueData.isValidColor(instrumentValueData.currentColor) ? instrumentValueData.currentColor : qgcPal.text
text: valueText() text: valueText()
function valueText() { function valueText() {

Loading…
Cancel
Save