forked from qt-creator/qt-creator
QmlDesigner: Use correct Enumeration type for instance values
Puppet used to return just string for enumeration types. Now it will use Enumeration type properly. Change-Id: I602891e34c03cb659ee0a8e4571b39b6e24f9e1c Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -1187,8 +1187,9 @@ InformationChangedCommand NodeInstanceServer::createAllInformationChangedCommand
|
|||||||
|
|
||||||
static bool supportedVariantType(int type)
|
static bool supportedVariantType(int type)
|
||||||
{
|
{
|
||||||
return type < int(QVariant::UserType) && type != QMetaType::QObjectStar
|
return (type < int(QVariant::UserType) && type != QMetaType::QObjectStar
|
||||||
&& type != QMetaType::QModelIndex && type != QMetaType::VoidStar;
|
&& type != QMetaType::QModelIndex && type != QMetaType::VoidStar)
|
||||||
|
|| type == QMetaType::fromType<Enumeration>().id();
|
||||||
}
|
}
|
||||||
|
|
||||||
ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QList<ServerNodeInstance> &instanceList) const
|
ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QList<ServerNodeInstance> &instanceList) const
|
||||||
|
@@ -619,7 +619,8 @@ QVariant ObjectNodeInstance::property(const PropertyName &name) const
|
|||||||
QQmlProperty property(object(), QString::fromUtf8(name), context());
|
QQmlProperty property(object(), QString::fromUtf8(name), context());
|
||||||
if (property.property().isEnumType()) {
|
if (property.property().isEnumType()) {
|
||||||
QVariant value = property.read();
|
QVariant value = property.read();
|
||||||
return property.property().enumerator().valueToKey(value.toInt());
|
QMetaEnum me = property.property().enumerator();
|
||||||
|
return QVariant::fromValue<Enumeration>(Enumeration(me.scope(), me.valueToKey(value.toInt())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property.propertyType() == QVariant::Url) {
|
if (property.propertyType() == QVariant::Url) {
|
||||||
|
Reference in New Issue
Block a user