--- a/ui/qt/entry.cpp Sun Aug 24 15:24:16 2025 +0200 +++ b/ui/qt/entry.cpp Sat Oct 04 14:52:59 2025 +0200 @@ -36,14 +36,19 @@ -UIWIDGET ui_spinner_create(UiObject *obj, UiSpinnerArgs *args) { +UIWIDGET ui_spinbox_create(UiObject *obj, UiSpinBoxArgs *args) { UiContainerPrivate *ctn = ui_obj_container(obj); UI_APPLY_LAYOUT(ctn->layout, args); + double min = args->min; + double max = args->max != 0 ? args->max : 100000; + bool use_double = false; UiVar *var = NULL; + UiVarType vartype = UI_VAR_SPECIAL; if(args->varname) { var = uic_get_var(obj->ctx, args->varname); + vartype = var->type; if(var->type == UI_VAR_DOUBLE) { use_double = true; } else if(var->type == UI_VAR_RANGE) { @@ -57,11 +62,14 @@ if(!var) { if(args->intvalue) { var = uic_widget_var(obj->ctx, obj->ctx, args->intvalue, NULL, UI_VAR_INTEGER); + vartype = UI_VAR_INTEGER; } else if(args->doublevalue) { var = uic_widget_var(obj->ctx, obj->ctx, args->doublevalue, NULL, UI_VAR_DOUBLE); + vartype = UI_VAR_DOUBLE; use_double = true; } else if(args->rangevalue) { var = uic_widget_var(obj->ctx, obj->ctx, args->rangevalue, NULL, UI_VAR_RANGE); + vartype = UI_VAR_RANGE; use_double = true; } else { if(args->digits > 0) { @@ -70,6 +78,12 @@ } } + if(vartype == UI_VAR_RANGE) { + UiRange *r = (UiRange*)var->value; + min = r->min; + max = r->max; + } + QAbstractSpinBox *widget = nullptr; if(use_double) { QDoubleSpinBox *spinbox = new QDoubleSpinBox(); @@ -77,17 +91,21 @@ if(args->step != 0) { spinbox->setSingleStep(args->step); } + spinbox->setMinimum(min); + spinbox->setMaximum(max); widget = spinbox; } else { QSpinBox *spinbox = new QSpinBox(); if(args->step != 0) { spinbox->setSingleStep(args->step); } + spinbox->setMinimum((int)min); + spinbox->setMaximum((int)max); widget = spinbox; } if(var) { - if(var->type == UI_VAR_INTEGER) { + if(vartype == UI_VAR_INTEGER) { UiInteger *value = (UiInteger*)var->value; value->obj = widget; if(value->value != 0) { @@ -96,7 +114,7 @@ } value->get = ui_spinbox_int_get; value->set = ui_spinbox_int_set; - } else if(var->type == UI_VAR_DOUBLE) { + } else if(vartype == UI_VAR_DOUBLE) { UiDouble *value = (UiDouble*)var->value; value->obj = widget; if(value->value != 0) { @@ -105,7 +123,7 @@ } value->get = ui_spinbox_double_get; value->set = ui_spinbox_double_set; - } else if(var->type == UI_VAR_RANGE) { + } else if(vartype == UI_VAR_RANGE) { UiRange *value = (UiRange*)var->value; value->obj = widget; QDoubleSpinBox *spinbox = (QDoubleSpinBox*)widget;