[Core] Add possibility to set color with tuple of integers, fixes #8344

This commit is contained in:
0penBrain
2023-02-11 18:48:21 +01:00
parent e9e68c5bf3
commit ebc5cb16a9
2 changed files with 47 additions and 42 deletions

View File

@@ -3270,11 +3270,10 @@ void PropertyColorItem::setValue(const QVariant& value)
if (hasExpression() || !value.canConvert<QColor>())
return;
auto col = value.value<QColor>();
App::Color val; val.setValue<QColor>(col);
QString data = QString::fromLatin1("(%1,%2,%3)")
.arg(val.r, 0, 'f', decimals())
.arg(val.g, 0, 'f', decimals())
.arg(val.b, 0, 'f', decimals());
.arg(col.red())
.arg(col.green())
.arg(col.blue());
setPropertyValue(data);
}