aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-09-18 16:17:42 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-09-23 14:54:47 +0200
commit39b5be920cf65979df669d02a3410a7396be6ada (patch)
tree26f91a48ed294e48b907e0a8a98b2ad6baf187f0 /src/qml/qml/qqmlobjectcreator.cpp
parent55158d25127173f4a96f2fa70fa7603fa81f8bd9 (diff)
Eliminate QQmlValueTypeProvider::storeValueType()
It was only used for QColor. The string representation of QColor was funneled through the color provider to get a numerical RGBA value and that one was passed to storeValueType() which would create a QColor object. The RGBA value was retrieved by creating a QColor object. We can just directly create the QColor from the string, and we can use the generic create() method for that. Change-Id: If36775830882237e5e36f748872ce23530c3bb71 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 310f8579bf..809d1c4976 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -483,12 +483,10 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const
}
break;
case QMetaType::QColor: {
- bool ok = false;
- uint colorValue = QQmlStringConverters::rgbaFromString(compilationUnit->bindingValueAsString(binding), &ok);
- assertOrNull(ok);
- struct { void *data[4]; } buffer;
- if (QQml_valueTypeProvider()->storeValueType(property->propType(), &colorValue, &buffer, sizeof(buffer))) {
- property->writeProperty(_qobject, &buffer, propertyWriteFlags);
+ QVariant data;
+ if (QQml_valueTypeProvider()->createValueFromString(
+ QMetaType::QColor, compilationUnit->bindingValueAsString(binding), &data)) {
+ property->writeProperty(_qobject, data.data(), propertyWriteFlags);
}
}
break;