QDial doesn't stop at end point issue
-
Hi all, I have added Qdial in my Qt Application. I am trying to set a start and end point to the Dial pointer. Dial pointer could be moved from start point to end point directly and vice versa, which shouldn't happen. Is there any way to stop the pointer at the end point and prevent it from moving to start point directly while trying
Thanks in advance : )
-
@Dharani-Prasad Do you mean that the user can drag the dial handle from start to finish (e.g. 0 to 100 without going through 50) or that something the program does causes this to happen?
-
@Dharani-Prasad Do you mean that the user can drag the dial handle from start to finish (e.g. 0 to 100 without going through 50) or that something the program does causes this to happen?
@ChrisW67 said in QDial doesn't stop at end point issue:
user can drag the dial handle from start to finish (e.g. 0 to 100 without going through 50) and (100 to 0 without going back through 50)
This shouldn't happen.
-
@ChrisW67 said in QDial doesn't stop at end point issue:
user can drag the dial handle from start to finish (e.g. 0 to 100 without going through 50) and (100 to 0 without going back through 50)
This shouldn't happen.
@Dharani-Prasad have you changed the wrapping property of your dial from the default false?
And it's still not clear what the unwanted behaviour is, can you show some code / gif?
-
What you are describing is the documented behaviour of the QDial. When the user drags the slider out of range it snaps the the nearest end point. You would not like it to happen...not quite the same thing as it shouldn't happen.
There is no simple way to change that behaviour. You could try experimenting with sliderMOved() signals in a slot that tracks the previous value and disallows max->min or min->max transitions. This will be difficult to get just right.
-
Respectfully agreeing with @Dharani-Prasad , this shouldn't happen because it is not the expected behavior of a UI dial control in any other context (just as you can't turn a physical knob from min directly to max in the CCW direction and vice-versa). This should be corrected in a future release, at least by option.
Meanwhile, has anyone found a hack to prevent this? I tried putting < min and > max zones at the ends, resetting the value back to min/max if the user ventured into the zone, but this didn't work. Looking for other ideas.
-
@Eric-Singer said in QDial doesn't stop at end point issue:
This should be corrected in a future release, at least by option.
I don't have this problem but also don't have https://doc.qt.io/qt-5/qdial.html#wrapping-prop set to true. Please provide a minimal, compilable example where you can show your issue.