@@ -46,7 +46,7 @@ def __init__(
4646bins_start .setStepType (QAbstractSpinBox .AdaptiveDecimalStepType )
4747bins_start .setRange (- 1e10 ,1e10 )
4848bins_start .setValue (0 )
49- bins_start .setWrapping (True )
49+ bins_start .setWrapping (False )
5050bins_start .setKeyboardTracking (False )
5151bins_start .setDecimals (2 )
5252
@@ -55,6 +55,7 @@ def __init__(
5555bins_stop .setStepType (QAbstractSpinBox .AdaptiveDecimalStepType )
5656bins_stop .setRange (- 1e10 ,1e10 )
5757bins_stop .setValue (100 )
58+ bins_start .setWrapping (False )
5859bins_stop .setKeyboardTracking (False )
5960bins_stop .setDecimals (2 )
6061
@@ -148,13 +149,17 @@ def on_update_layers(self) -> None:
148149self .autoset_widget_bins (data = layer_data )
149150
150151# Only allow integer bins for integer data
152+ # And only allow values greater than 0 for unsigned integers
151153n_decimals = 0 if np .issubdtype (layer_data .dtype ,np .integer )else 2
152- self .findChild (QDoubleSpinBox ,name = "bins start" ).setDecimals (
153- n_decimals
154- )
155- self .findChild (QDoubleSpinBox ,name = "bins stop" ).setDecimals (
156- n_decimals
157- )
154+ is_unsigned = layer_data .dtype .kind == "u"
155+ minimum_value = 0 if is_unsigned else - 1e10
156+
157+ bins_start = self .findChild (QDoubleSpinBox ,name = "bins start" )
158+ bins_stop = self .findChild (QDoubleSpinBox ,name = "bins stop" )
159+ bins_start .setDecimals (n_decimals )
160+ bins_stop .setDecimals (n_decimals )
161+ bins_start .setMinimum (minimum_value )
162+ bins_stop .setMinimum (minimum_value )
158163
159164def draw (self )-> None :
160165"""
@@ -169,7 +174,7 @@ def draw(self) -> None:
169174self .bins_start ,
170175self .bins_stop ,
171176self .bins_num ,
172- dtype = int if np . issubdtype ( data .dtype , np . integer ) else float ,
177+ dtype = data .dtype ,
173178 )
174179
175180if layer .rgb :