0
내 게이지가 빨간색, 노란색, 녹색 섹션으로 나뉘어져 있어야합니다.QML 스타일 게이지
나는 시도했다 :
Gauge {
id: gauge
anchors.top: parent.top; anchors.topMargin: 20; anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 20
minimumValue: -500
maximumValue: 500
value: 200
tickmarkStepSize: 100
orientation: Qt.Horizontal
font.bold: true; font.pixelSize: 12
style: GaugeStyle {
background: Rectangle {
implicitWidth: 15
implicitHeight: gauge.width
color: "red"
Rectangle {
implicitWidth: 15
implicitHeight: gauge.width/2
anchors.verticalCenter: parent.verticalCenter
color: "green"
}
}
valueBar: Rectangle {
implicitWidth: 15
color: "transparent"; border.color: "black"
}
tickmark: Item {
implicitHeight: 1; implicitWidth: 15
Rectangle {
color: "black"
anchors.fill: parent; anchors.leftMargin: 3; anchors.rightMargin: 3
}
}
minorTickmark: Item {
implicitWidth: 8; implicitHeight: 1
Rectangle {
color: "lightGrey"
anchors.fill: parent; anchors.leftMargin: 3; anchors.rightMargin: 3
}
}
}
}
을하지만, 녹색 빨간색과 노란색을 정확히 얘기하는 번호가 시작 (최종) 필요로 매우 부정확이다 (필자는 노란색을 그려하지 않은 순간).
또한 valuebar의 스타일을 지정해야합니다 (배경 사각형의 동일한 색상을 사용하는 사각형이어야하지만 더 어둡습니다). 불가능한 경우 실제 값이있는 곳에 두꺼운 표시를해야합니다.