Gauge QML and tickmark direction?



  • In my attempt to learn Qt and QML: Is there a possibility to instruct the Gauge in QML to display the tickmark from right to left when the orientation is horizontal? I.e. from 0 1 2 3 ... to ... 3 2 1 0

    My current code is:

                Gauge {
                    id: gaugeBdFR
                    minimumValue: 0
                    value: tBdFR
                    width: parent.width*0.4
                    maximumValue: 40
                    minorTickmarkCount: 5
                    tickmarkStepSize : 5
                    orientation: Qt.Horizontal
    
                    formatValue: function(value) {
                        return value.toFixed(0);
                    }
    
                    style: GaugeStyle {
                        valueBar: Rectangle {
                            implicitWidth: 38
                            color: Qt.rgba(gaugeBdFR.value / gaugeBdFR.maximumValue, 1- gaugeBdFR.value /(gaugeBdFR.maximumValue+1), 0, 1)
                        }
    
                        minorTickmark: Item {
                            implicitWidth: 8
                            implicitHeight: 1
    
                            Rectangle {
                                color: "#cccccc"
                                anchors.fill: parent
                                anchors.leftMargin: 2
                                anchors.rightMargin: 4
                            }
                        }
                    }
                } 
    
    


  • Hi! Do you mean like this?

    gauge


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.