forked from qt-creator/qt-creator
QmlDesigner: Add workaround for QVector3D
For some reason the Qt meta system does not work reliable for QVector3D. It does work "rotation", but not for "pivot", despite the fact that both properties are defined in exactly the same way. This patch works around the main issue. There are still a few issues left, but at least the default is correct now. Task-number: QDS-1355 Change-Id: I75e2d3adff6967e89c6ce031d744baa12b5e8061 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
e5d4224fe4
commit
2f2787c4a8
@@ -571,11 +571,30 @@ QVariant ObjectNodeInstance::property(const PropertyName &name) const
|
||||
return property.read();
|
||||
}
|
||||
|
||||
void ObjectNodeInstance::ensureVector3DDotProperties(PropertyNameList &list) const
|
||||
{
|
||||
const PropertyNameList properties = { "rotation", "scale", "pivot" };
|
||||
for (const auto &property : properties) {
|
||||
if (list.contains(property) && instanceType(property) == "QVector3D") {
|
||||
const PropertyNameList dotProperties = { "x", "y", "z" };
|
||||
for (const auto &dotProperty : dotProperties) {
|
||||
const PropertyName dotPropertyName = property + "." + dotProperty;
|
||||
if (!list.contains(dotPropertyName))
|
||||
list.append(dotPropertyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PropertyNameList ObjectNodeInstance::propertyNames() const
|
||||
{
|
||||
PropertyNameList list;
|
||||
if (isValid())
|
||||
return QmlPrivateGate::allPropertyNames(object());
|
||||
return PropertyNameList();
|
||||
list = QmlPrivateGate::allPropertyNames(object());
|
||||
|
||||
ensureVector3DDotProperties(list);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
QString ObjectNodeInstance::instanceType(const PropertyName &name) const
|
||||
|
@@ -209,6 +209,7 @@ protected:
|
||||
static QVariant enumationValue(const Enumeration &enumeration);
|
||||
|
||||
void initializePropertyWatcher(const ObjectNodeInstance::Pointer &objectNodeInstance);
|
||||
void ensureVector3DDotProperties(PropertyNameList &list) const;
|
||||
private:
|
||||
QString m_id;
|
||||
|
||||
|
Reference in New Issue
Block a user