@@ -46,7 +46,7 @@ def __init__(
4646 bins_start .setStepType (QAbstractSpinBox .AdaptiveDecimalStepType )
4747 bins_start .setRange (- 1e10 , 1e10 )
4848 bins_start .setValue (0 )
49- bins_start .setWrapping (True )
49+ bins_start .setWrapping (False )
5050 bins_start .setKeyboardTracking (False )
5151 bins_start .setDecimals (2 )
5252
@@ -55,6 +55,7 @@ def __init__(
5555 bins_stop .setStepType (QAbstractSpinBox .AdaptiveDecimalStepType )
5656 bins_stop .setRange (- 1e10 , 1e10 )
5757 bins_stop .setValue (100 )
58+ bins_start .setWrapping (False )
5859 bins_stop .setKeyboardTracking (False )
5960 bins_stop .setDecimals (2 )
6061
@@ -165,13 +166,17 @@ def on_update_layers(self) -> None:
165166 self .autoset_widget_bins (data = layer_data )
166167
167168 # Only allow integer bins for integer data
169+ # And only allow values greater than 0 for unsigned integers
168170 n_decimals = 0 if np .issubdtype (layer_data .dtype , np .integer ) else 2
169- self .findChild (QDoubleSpinBox , name = "bins start" ).setDecimals (
170- n_decimals
171- )
172- self .findChild (QDoubleSpinBox , name = "bins stop" ).setDecimals (
173- n_decimals
174- )
171+ is_unsigned = layer_data .dtype .kind == "u"
172+ minimum_value = 0 if is_unsigned else - 1e10
173+
174+ bins_start = self .findChild (QDoubleSpinBox , name = "bins start" )
175+ bins_stop = self .findChild (QDoubleSpinBox , name = "bins stop" )
176+ bins_start .setDecimals (n_decimals )
177+ bins_stop .setDecimals (n_decimals )
178+ bins_start .setMinimum (minimum_value )
179+ bins_stop .setMinimum (minimum_value )
175180
176181 def draw (self ) -> None :
177182 """
0 commit comments