[SOLVED] QML Dial draw circle
I want to subclass the QML class Dial like explained here :
Unfortunately, they don't show how to rewrite the method to draw the arc between the Minimum value and the current value like that :
Attached image is not found at this moment.
Thanks, didn't see that. I reuploaded the screenshot.
I think, the best solution is to use a Canvas and draw your arc with it.
Bad solution is to use Rectangle inside some Item('s) that clip that form of the sector you need and one more Rectangle above to make a ring.
@Roumed Thank you for your answer. Could you please provide a little more details of the methods to use for the Canvas?
@BlackMamba I can give a similar thing.
You can look at PieMenu.
It's background is a half of circle. So it's implementation contains drawing at canvas.
See here: qt/qtquickcontrols/src/extras/Styles/Flat/PieMenuStyle.qml
@Roumed Thanks so much, I will have a look tonight !
Doesn't look so easy. What I don't understand is that the image I showed is the standard Dial behavior in QML.
But when I have a look at the source code and all the files Dial.qml, I don't see the method to draw this circle ... How is that possible? Is that behavior coded in c++ ?
Yes, it is, its ring draws in C++ at qt/qtquickcontrols2/src/imports/controls/qquickdialring.cpp and inserts as background to the control background.
@Roumed Thanks! I successfully coded it with Canvas thanks to your help.