How to implement a "speedometer" item?



  • Hi all,
    This is vishal. I am newbie to this QT quick and QML. I am trying to develop a project using QT quick and QML. I am trying to develop a speedometer in which there are two text label, one is for maximum and the other is for minimum. If we give the maximum value the speedometer has to take that value. For example if we give the minimum value as 0 and max as 200 the speedometer has to show the values from 0 to 200 or if i give them from 0 to 100 the speedometer has to show the values from 0 to 100. I dont want the analog in the speedometer to move i just want the values to be changed. The other thing is can we create a speedometer image and add the values or else do we have to only take the static image of speedometer and add to them?

    So,guys please help me out to solve the above problem.

    Thanks,
    Vishal.

    [Edit: Changed title -- @Wieland]



  • Hi! Please give your thread a meaningful title. Also see Hitchhiker's Visual Guide to the Qt Forum and Forum general guide.

    There is already a "speedometer", see CircularGauge QML Type. You can customize its appearance with CircularGaugeStyle QML Type.



  • HI,
    Thanks for the reply. I know that there is a speedometer in the qt documentation. But what i want is entirely different. I want to change the values in the speedometer. I don't want the needle to move but i just want the values in the speedometer to change. I want the following to create the speedometer
    -> I need to create a speedometer using the QT quick widgets. I don't want to add a static image to the qt.
    -> once i created the speedometer, i want to change the min and max values on the speedometer i.e., if i give the min values as 0 and give the max value as 100 the speedometer has to change the values from 0 to 100. See here i don't want the needle in the speedmoter to move i just want values to be changed. If i give min values as 0 and max 270 the values on the speedometer has to change accordingly to the given min and max values.

    Hope you understand the problem and will give some inputs to the above problem.



  • I don't see how what you want is any different from what CircularGauge provides: It has maximumValue, minimumValue, stepSize. These values aren't fixed, but can be changed during the lifetime of the component as frequent as you wish. And the background can be made of arbitrary visual components; no need to add an image.

    Anyway, if you want to build a new component from scratch, you can either write it entirely in QML, or write a Quick item in C++, by deriving from QQuickPaintedItem.



  • Hi,
    thanks for your response .my project is to develop a tool of speed gauge and i have to drag those tool and then i have to give the values of min and max ,if i change the values of speedometer needle should not movie all i need is the value should change accordingly,for example min value as 0 max value is 100 if i change the min value to 10 the min value should be changed accordingly remaining values should also change from min to max.all values in the speedometer must change accordingly.


Log in to reply
 

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