Commit b5262c9b authored by Kai Koehne's avatar Kai Koehne

QmlDesigner: Fix crash when changing the transform origin of an item

Fixes crash when changing the transform origin of an item in the
Property Editor. The fundamental problem is that the metatype system
doesn't know about the enum. We used to return then an invalid QVariant
when trying to convert the string to a QVariant. Now we instead return
a valid QVariant, but with wrong type (QString).

Task-number: BAUHAUS-522
Reviewed-by: Erik Verbruggen
parent b3ad65d8
......@@ -63,10 +63,13 @@ QVariant read(const QString &typeStr, const QString &str, const MetaInfo &metaIn
QVariant read(const QString &typeStr, const QString &str)
{
int type = QMetaType::type(typeStr.toAscii().constData());
if (type == 0)
if (type == 0) {
qWarning() << "Type " << typeStr
<< " is unknown to QMetaType system. Cannot create properly typed QVariant for value "
<< str;
// Fall back to a QVariant of type String
return QVariant(str);
}
return read(type, str);
}
......@@ -108,9 +111,9 @@ QVariant read(int variantType, const QString &str)
}
if (!conversionOk) {
value = QVariant();
qWarning() << "Could not convert" << str
<< "to" << QMetaType::typeName(variantType);
value = QVariant(str);
}
return value;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment