Allow to enter empty values in PropertyFloatList and PropertyIntegerList - issue #2535
This commit is contained in:
parent
9ee892eb35
commit
a38a78f6d6
|
@ -1151,9 +1151,10 @@ public:
|
||||||
QStringList lines;
|
QStringList lines;
|
||||||
if (edit) {
|
if (edit) {
|
||||||
QString inputText = edit->toPlainText();
|
QString inputText = edit->toPlainText();
|
||||||
|
if (!inputText.isEmpty()) // let pass empty input, regardless of the type, so user can void the value
|
||||||
lines = inputText.split(QString::fromLatin1("\n"));
|
lines = inputText.split(QString::fromLatin1("\n"));
|
||||||
}
|
}
|
||||||
|
if (!lines.isEmpty()) {
|
||||||
if (type == 1) { // floats
|
if (type == 1) { // floats
|
||||||
bool ok;
|
bool ok;
|
||||||
int line=1;
|
int line=1;
|
||||||
|
@ -1176,7 +1177,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2091,7 +2091,6 @@ QVariant PropertyFloatListItem::toString(const QVariant& prop) const
|
||||||
list.append(QLatin1String("..."));
|
list.append(QLatin1String("..."));
|
||||||
}
|
}
|
||||||
QString text = QString::fromUtf8("[%1]").arg(list.join(QLatin1String(",")));
|
QString text = QString::fromUtf8("[%1]").arg(list.join(QLatin1String(",")));
|
||||||
|
|
||||||
return QVariant(text);
|
return QVariant(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2120,6 +2119,8 @@ void PropertyFloatListItem::setValue(const QVariant& value)
|
||||||
str << *it << ",";
|
str << *it << ",";
|
||||||
}
|
}
|
||||||
str << "]";
|
str << "]";
|
||||||
|
if (data == QString::fromUtf8("[,]"))
|
||||||
|
data = QString::fromUtf8("[]");
|
||||||
setPropertyValue(data);
|
setPropertyValue(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2193,6 +2194,8 @@ void PropertyIntegerListItem::setValue(const QVariant& value)
|
||||||
str << *it << ",";
|
str << *it << ",";
|
||||||
}
|
}
|
||||||
str << "]";
|
str << "]";
|
||||||
|
if (data == QString::fromUtf8("[,]"))
|
||||||
|
data = QString::fromUtf8("[]");
|
||||||
setPropertyValue(data);
|
setPropertyValue(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user