Graphic bug
-
hi,
i just had a strange issue.
i want to make a CircularGauge - like component using Repeaterimport QtQuick 2.12 import QtQuick.Controls 2.12 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") id: w property double centerX :150 property double centerY : 150 property int rad : 60 Slider{ id: sl from: 1 to : 360 value: 150 stepSize: 1 } Repeater{ id:rp anchors.centerIn: parent model:sl.value Rectangle{ height: 10 width: 10 radius: 5 color: "blue" x : centerX + (centerX + (rad * Math.sin(index * 2 * (Math.PI / 360))) ) y : centerY + (centerY + (rad * Math.cos(index * 2 * (Math.PI / 360))) ) } } }
then if i move the sliders handle ..
is there something stupid in my code ? Im sure not, because if i remove the the binding of the repeater
model : sl.value
and change de model manually it works properly
-
Then custom
QQuickPaintedItem
? Not sure if having 360 dymically created rectangles is a good idea. -
Your code is working fine for me with Qt 5.14 and linux mint. Also wouldn't it be better to use
Shape
andPathArc
? -
hi
@IntruderExcluder said in Graphic bug:Your code is working fine for me with Qt 5.14
Thank you for confirming. My Qt version is 5.13.0 and platform is windows10.
I will need to control every point individually, im not sure i can using Shape and PathArc
-
Then custom
QQuickPaintedItem
? Not sure if having 360 dymically created rectangles is a good idea. -
@IntruderExcluder said in Graphic bug:
Not sure if having 360 dymically created rectangles is a good idea.
That is may be the issue. Because the same code with less rectangles works correctly.
It looks like the limit is 30... if i bind sliders value to repeaters modelimport QtQuick 2.12 import QtQuick.Controls 2.12 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") id: w property double centerX :150 property double centerY : 150 property int rad : 60 Slider{ id: sl from: 1 to :30 stepSize: 1 } Repeater{ id:rp anchors.centerIn: parent model:sl.value Rectangle{ height: 10 width: 10 radius: 5 color: "blue" x : centerX + (centerX + (rad * Math.sin(index * 2 * (Math.PI / 30))) ) y : centerY + (centerY + (rad * Math.cos(index * 2 * (Math.PI / 30))) ) } } }
But if use hardcoded value, i can even put 2000 as model and there is no bug
This tired me, this is first time i observe such stupid behavior in QtQuick@IntruderExcluder thx for your inputs, i will try with QQuickPaintedItem