Closed Czaki closed 1 year ago
sounds like an easy fix. anyone want to take this one? if not, I should be able to get to it next week
I'm not sure where I will have time. But if I got time to write this I will post a message here.
Would you just have setRange
compare value
to the range, and if outside it then call setValue
? If that is on the general right track, then I can give it a whirl.
I think that's the case @psobolewskiPhD. I wouldn't even compare, I'd just do, in setRange
, setValue(clip(value, minval, maxval))
for a suitable definition of clip. ;)
Would you just have
setRange
comparevalue
to the range, and if outside it then callsetValue
? If that is on the general right track, then I can give it a whirl.
I suggest put this logic in setMinimum
and setMaximum
as this function are called in setRange
EDIT
ist looks like it could be nice to add check if minimum is lower than maximum in setRange
it could be nice to add check if minimum is lower than maximum in setRange
So this is the case where someone does setRange(100, 0) or similar. In this case is it better to raise a ValueError or just swap min and max so they are correct?
So this is the case where someone does setRange(100, 0) or similar. In this case is it better to raise a ValueError or just swap min and max so they are correct?
I think that you should mimic Qt behaviour:
from qtpy.QtWidgets import QSpinBox
w = QSpinBox()
w.setRange(0, 100)
w.setRange(1000, 0)
w.minimum(), w.maximum()
Out[5]: (1000, 1000)
Describe the bug
When update range in
QLargeIntSpinBox
the value is not clipped to new rangehttps://github.com/napari/napari/pull/6479#issuecomment-1822181081
To Reproduce Steps to reproduce the behavior:
and value remains 500 instead of 100
Expected behavior
Presented data should be clipped to the new range
cc @jni