diff --git a/libs/piqt_utils/pivariant_edit_widgets.cpp b/libs/piqt_utils/pivariant_edit_widgets.cpp index 4188e3c..1aedea1 100644 --- a/libs/piqt_utils/pivariant_edit_widgets.cpp +++ b/libs/piqt_utils/pivariant_edit_widgets.cpp @@ -195,6 +195,7 @@ void PIVariantEditors::NumberBase::retranslate() { void PIVariantEditors::NumberBase::applyAttributes(const PIVariantMap & a) { Type new_type = static_cast(a.value(Attribute::widgetType).toEnum().selectedValue()); + if (new_type == tInvalid) new_type = tSpinBox; if (type != new_type) { type = new_type; if (widget) delete widget; @@ -215,10 +216,10 @@ void PIVariantEditors::NumberBase::applyAttributes(const PIVariantMap & a) { } prefix = a.value(Attribute::prefix).toString(); suffix = a.value(Attribute::suffix).toString(); - double min = a.value(Attribute::minimum).toDouble(); - double max = a.value(Attribute::maximum).toDouble(); - double step = a.value(Attribute::singleStep).toDouble(); - int dec = is_int ? 0 : a.value(Attribute::decimals).toInt(); + double min = a.value(Attribute::minimum, -65535).toDouble(); + double max = a.value(Attribute::maximum, 65535).toDouble(); + double step = a.value(Attribute::singleStep, 1.).toDouble(); + int dec = is_int ? 0 : a.value(Attribute::decimals, 2).toInt(); switch (type) { case tSpinBox: { auto * w = qobject_cast(widget);