PIVariantEditors::NumberBase works without attributes
This commit is contained in:
@@ -195,6 +195,7 @@ void PIVariantEditors::NumberBase::retranslate() {
|
|||||||
|
|
||||||
void PIVariantEditors::NumberBase::applyAttributes(const PIVariantMap & a) {
|
void PIVariantEditors::NumberBase::applyAttributes(const PIVariantMap & a) {
|
||||||
Type new_type = static_cast<Type>(a.value(Attribute::widgetType).toEnum().selectedValue());
|
Type new_type = static_cast<Type>(a.value(Attribute::widgetType).toEnum().selectedValue());
|
||||||
|
if (new_type == tInvalid) new_type = tSpinBox;
|
||||||
if (type != new_type) {
|
if (type != new_type) {
|
||||||
type = new_type;
|
type = new_type;
|
||||||
if (widget) delete widget;
|
if (widget) delete widget;
|
||||||
@@ -215,10 +216,10 @@ void PIVariantEditors::NumberBase::applyAttributes(const PIVariantMap & a) {
|
|||||||
}
|
}
|
||||||
prefix = a.value(Attribute::prefix).toString();
|
prefix = a.value(Attribute::prefix).toString();
|
||||||
suffix = a.value(Attribute::suffix).toString();
|
suffix = a.value(Attribute::suffix).toString();
|
||||||
double min = a.value(Attribute::minimum).toDouble();
|
double min = a.value(Attribute::minimum, -65535).toDouble();
|
||||||
double max = a.value(Attribute::maximum).toDouble();
|
double max = a.value(Attribute::maximum, 65535).toDouble();
|
||||||
double step = a.value(Attribute::singleStep).toDouble();
|
double step = a.value(Attribute::singleStep, 1.).toDouble();
|
||||||
int dec = is_int ? 0 : a.value(Attribute::decimals).toInt();
|
int dec = is_int ? 0 : a.value(Attribute::decimals, 2).toInt();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case tSpinBox: {
|
case tSpinBox: {
|
||||||
auto * w = qobject_cast<QDoubleSpinBox *>(widget);
|
auto * w = qobject_cast<QDoubleSpinBox *>(widget);
|
||||||
|
|||||||
Reference in New Issue
Block a user