QSpinbox wrapped
-
Is there an easy way to detect that a spin box value has wrapped and in which direction it has wrapped?
Can valueChanged() be pressed into service to detect this?
Keep the previous value and compare the new value when change is signalled?
If prev value == max() and new value is less then it went from max to min,
if prev value == min and new value is greater then it went from min t o maxor am I incorrect?
-
Keep the previous value and compare the new value when change is signalled?
If prev value == max() and new value is less then it went from max to min,
if prev value == min and new value is greater then it went from min t o maxor am I incorrect?
-
@SamiV123 Yes, that would work I guess - was hoping for a signal or event that was already implemented.
@Perdrix said in QSpinbox wrapped:
was hoping for a signal or event that was already implemented.
So why not simply looking in the documentation then?
-
Is there an easy way to detect that a spin box value has wrapped and in which direction it has wrapped?
Can valueChanged() be pressed into service to detect this?
@Perdrix said in QSpinbox wrapped:
Is there an easy way to detect that a spin box value has wrapped and in which direction it has wrapped?
I think I would actually most likely do this by subclassing and overriding void QAbstractSpinBox::stepBy(int steps). That feels like the correct level to recognise the situation from all the applicable inputs, and not mistakenly act on
setValue()
from code. -
@Perdrix said in QSpinbox wrapped:
was hoping for a signal or event that was already implemented.
So why not simply looking in the documentation then?
@Christian-Ehrlicher I did look but didn't see an easy way to do that - which is why I asked.
-
@Perdrix said in QSpinbox wrapped:
Is there an easy way to detect that a spin box value has wrapped and in which direction it has wrapped?
I think I would actually most likely do this by subclassing and overriding void QAbstractSpinBox::stepBy(int steps). That feels like the correct level to recognise the situation from all the applicable inputs, and not mistakenly act on
setValue()
from code.