forked from qt-creator/qt-creator
Fix a wrong property conversion
QVariant::canConvert returns just the general ability to convert from one type to the other and does not reflect if the specific string inside the variant can be converted. For this reason tmp.canConvert(QMetaType::Double) returned always true which lead to colors inside keyframes becoming black as soon as the scene was saved. Fixes: QDS-6960 Change-Id: I1a267d93a7cffb080ae884df490e5723592a2780 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Aleksei German <aleksei.german@qt.io>
This commit is contained in:
@@ -249,14 +249,11 @@ QVariant read(int variantType, const QString &str)
|
|||||||
if (str == "false")
|
if (str == "false")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto tmp = QVariant(str);
|
if (auto f = QVariant(str).toDouble(&conversionOk); conversionOk)
|
||||||
conversionOk = tmp.isValid();
|
return f;
|
||||||
value = QVariant(tmp);
|
else if (auto c = colorFromString(str, &conversionOk); conversionOk)
|
||||||
|
return c;
|
||||||
|
|
||||||
if (tmp.canConvert(QMetaType::Double))
|
|
||||||
value.convert(QMetaType::Double);
|
|
||||||
else if (tmp.canConvert(QMetaType::QColor))
|
|
||||||
value.convert(QMetaType::QColor);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QMetaType::QPoint:
|
case QMetaType::QPoint:
|
||||||
|
Reference in New Issue
Block a user