[SOLVED] QML Dial draw circle
-
wrote on 21 Nov 2016, 01:46 last edited by BlackMamba
Hello,
I want to subclass the QML class Dial like explained here :
http://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-dialUnfortunately, they don't show how to rewrite the method to draw the arc between the Minimum value and the current value like that :
Any idea?
THanks -
Hello,
I want to subclass the QML class Dial like explained here :
http://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-dialUnfortunately, they don't show how to rewrite the method to draw the arc between the Minimum value and the current value like that :
Any idea?
THankswrote on 21 Nov 2016, 09:33 last edited byAttached image is not found at this moment.
-
wrote on 21 Nov 2016, 09:52 last edited by
@Roumed
Thanks, didn't see that. I reuploaded the screenshot. -
@Roumed
Thanks, didn't see that. I reuploaded the screenshot.wrote on 21 Nov 2016, 10:01 last edited by Roumed@BlackMamba
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. -
@BlackMamba
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.wrote on 21 Nov 2016, 15:28 last edited by@Roumed Thank you for your answer. Could you please provide a little more details of the methods to use for the Canvas?
-
@Roumed Thank you for your answer. Could you please provide a little more details of the methods to use for the Canvas?
wrote on 21 Nov 2016, 16:58 last edited by@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 -
@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.qmlwrote on 21 Nov 2016, 17:39 last edited by@Roumed Thanks so much, I will have a look tonight !
-
wrote on 21 Nov 2016, 20:29 last edited by
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++ ? -
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++ ?wrote on 22 Nov 2016, 09:56 last edited by@BlackMamba
Yes, it is, its ring draws in C++ at qt/qtquickcontrols2/src/imports/controls/qquickdialring.cpp and inserts as background to the control background. -
@BlackMamba
Yes, it is, its ring draws in C++ at qt/qtquickcontrols2/src/imports/controls/qquickdialring.cpp and inserts as background to the control background.wrote on 22 Nov 2016, 12:13 last edited by@Roumed Thanks! I successfully coded it with Canvas thanks to your help.
1/10