diff options
author | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2013-03-05 12:19:19 +0100 |
---|---|---|
committer | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2013-03-05 12:34:39 +0100 |
commit | ee4bf638cad9bcf303c8c6ad1f922c33dc021964 (patch) | |
tree | abd2c363cc13cc6d805cf68e82cdf3c34836c87b /share/qtcreator/qml/qmlpuppet | |
parent | e74d4c4870fe48a2989d1b49404b9f00da3902a4 (diff) | |
download | qt-creator-ee4bf638cad9bcf303c8c6ad1f922c33dc021964.tar.gz |
QmlDesigner: Type of the propertyname is now PropertyName
And PropertyName is a typedef for QByteArray. Because we don't use the
features of QString and the source would be cluttered with QLatin1Strings
we changed the property name to QByteArray.
Change-Id: Ib70ef136bbc411504b450456bd9bb705ae93dd25
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet')
58 files changed, 511 insertions, 480 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/container/instancecontainer.cpp b/share/qtcreator/qml/qmlpuppet/container/instancecontainer.cpp index b885c7d993..efb173e817 100644 --- a/share/qtcreator/qml/qmlpuppet/container/instancecontainer.cpp +++ b/share/qtcreator/qml/qmlpuppet/container/instancecontainer.cpp @@ -38,11 +38,11 @@ InstanceContainer::InstanceContainer() { } -InstanceContainer::InstanceContainer(qint32 instanceId, const QString &type, int majorNumber, int minorNumber, const QString &componentPath, const QString &nodeSource, NodeSourceType nodeSourceType,NodeMetaType metaType) +InstanceContainer::InstanceContainer(qint32 instanceId, const TypeName &type, int majorNumber, int minorNumber, const QString &componentPath, const QString &nodeSource, NodeSourceType nodeSourceType, NodeMetaType metaType) : m_instanceId(instanceId), m_type(type), m_majorNumber(majorNumber), m_minorNumber(minorNumber), m_componentPath(componentPath), m_nodeSource(nodeSource), m_nodeSourceType(nodeSourceType), m_metaType(metaType) { - m_type.replace(QLatin1Char('.'), QLatin1Char('/')); + m_type.replace('.', '/'); } qint32 InstanceContainer::instanceId() const @@ -50,7 +50,7 @@ qint32 InstanceContainer::instanceId() const return m_instanceId; } -QString InstanceContainer::type() const +TypeName InstanceContainer::type() const { return m_type; } diff --git a/share/qtcreator/qml/qmlpuppet/container/instancecontainer.h b/share/qtcreator/qml/qmlpuppet/container/instancecontainer.h index 6c32cb243e..7be7d0983e 100644 --- a/share/qtcreator/qml/qmlpuppet/container/instancecontainer.h +++ b/share/qtcreator/qml/qmlpuppet/container/instancecontainer.h @@ -34,6 +34,8 @@ #include <QString> #include <QDataStream> +#include "nodeinstanceglobal.h" + namespace QmlDesigner { class InstanceContainer; @@ -58,10 +60,10 @@ public: }; InstanceContainer(); - InstanceContainer(qint32 instanceId, const QString &type, int majorNumber, int minorNumber, const QString &componentPath, const QString &nodeSource, NodeSourceType nodeSourceType, NodeMetaType metaType); + InstanceContainer(qint32 instanceId, const TypeName &type, int majorNumber, int minorNumber, const QString &componentPath, const QString &nodeSource, NodeSourceType nodeSourceType, NodeMetaType metaType); qint32 instanceId() const; - QString type() const; + TypeName type() const; int majorNumber() const; int minorNumber() const; QString componentPath() const; @@ -71,7 +73,7 @@ public: private: qint32 m_instanceId; - QString m_type; + TypeName m_type; qint32 m_majorNumber; qint32 m_minorNumber; QString m_componentPath; diff --git a/share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.cpp b/share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.cpp index 28066ade09..2ba89213eb 100644 --- a/share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.cpp +++ b/share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.cpp @@ -36,7 +36,7 @@ PropertyAbstractContainer::PropertyAbstractContainer() { } -PropertyAbstractContainer::PropertyAbstractContainer(qint32 instanceId, const QString &name, const QString &dynamicTypeName) +PropertyAbstractContainer::PropertyAbstractContainer(qint32 instanceId, const PropertyName &name, const QString &dynamicTypeName) : m_instanceId(instanceId), m_name(name), m_dynamicTypeName(dynamicTypeName) @@ -48,7 +48,7 @@ qint32 PropertyAbstractContainer::instanceId() const return m_instanceId; } -QString PropertyAbstractContainer::name() const +PropertyName PropertyAbstractContainer::name() const { return m_name; } diff --git a/share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.h b/share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.h index 242ef66e6d..ba468b4b53 100644 --- a/share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.h +++ b/share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.h @@ -34,6 +34,7 @@ #include <qmetatype.h> #include <QString> +#include "nodeinstanceglobal.h" namespace QmlDesigner { @@ -49,16 +50,16 @@ class PropertyAbstractContainer friend QDataStream &operator>>(QDataStream &in, PropertyAbstractContainer &container); public: PropertyAbstractContainer(); - PropertyAbstractContainer(qint32 instanceId, const QString &name, const QString &dynamicTypeName); + PropertyAbstractContainer(qint32 instanceId, const PropertyName &name, const QString &dynamicTypeName); qint32 instanceId() const; - QString name() const; + PropertyName name() const; bool isDynamic() const; QString dynamicTypeName() const; private: qint32 m_instanceId; - QString m_name; + PropertyName m_name; QString m_dynamicTypeName; }; diff --git a/share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.cpp b/share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.cpp index b0f5dd1aa9..f9602a7eb4 100644 --- a/share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.cpp +++ b/share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.cpp @@ -37,7 +37,7 @@ PropertyBindingContainer::PropertyBindingContainer() { } -PropertyBindingContainer::PropertyBindingContainer(qint32 instanceId, const QString &name, const QString &expression, const QString &dynamicTypeName) +PropertyBindingContainer::PropertyBindingContainer(qint32 instanceId, const PropertyName &name, const QString &expression, const TypeName &dynamicTypeName) : m_instanceId(instanceId), m_name(name), m_expression(expression), @@ -50,7 +50,7 @@ qint32 PropertyBindingContainer::instanceId() const return m_instanceId; } -QString PropertyBindingContainer::name() const +PropertyName PropertyBindingContainer::name() const { return m_name; } @@ -65,7 +65,7 @@ bool PropertyBindingContainer::isDynamic() const return !m_dynamicTypeName.isEmpty(); } -QString PropertyBindingContainer::dynamicTypeName() const +TypeName PropertyBindingContainer::dynamicTypeName() const { return m_dynamicTypeName; } diff --git a/share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.h b/share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.h index 439f16b2c9..f285320cab 100644 --- a/share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.h +++ b/share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.h @@ -34,6 +34,7 @@ #include <qmetatype.h> #include <QString> +#include "nodeinstanceglobal.h" namespace QmlDesigner { @@ -43,19 +44,19 @@ class PropertyBindingContainer public: PropertyBindingContainer(); - PropertyBindingContainer(qint32 instanceId, const QString &name, const QString &expression, const QString &dynamicTypeName); + PropertyBindingContainer(qint32 instanceId, const PropertyName &name, const QString &expression, const TypeName &dynamicTypeName); qint32 instanceId() const; - QString name() const; + PropertyName name() const; QString expression() const; bool isDynamic() const; - QString dynamicTypeName() const; + TypeName dynamicTypeName() const; private: qint32 m_instanceId; - QString m_name; + PropertyName m_name; QString m_expression; - QString m_dynamicTypeName; + TypeName m_dynamicTypeName; }; QDataStream &operator<<(QDataStream &out, const PropertyBindingContainer &container); diff --git a/share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.cpp b/share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.cpp index 66974c8888..894b90e47d 100644 --- a/share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.cpp +++ b/share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.cpp @@ -36,7 +36,7 @@ PropertyValueContainer::PropertyValueContainer() { } -PropertyValueContainer::PropertyValueContainer(qint32 instanceId, const QString &name, const QVariant &value, const QString &dynamicTypeName) +PropertyValueContainer::PropertyValueContainer(qint32 instanceId, const PropertyName &name, const QVariant &value, const TypeName &dynamicTypeName) : m_instanceId(instanceId), m_name(name), m_value(value), @@ -49,7 +49,7 @@ qint32 PropertyValueContainer::instanceId() const return m_instanceId; } -QString PropertyValueContainer::name() const +PropertyName PropertyValueContainer::name() const { return m_name; } @@ -64,7 +64,7 @@ bool PropertyValueContainer::isDynamic() const return !m_dynamicTypeName.isEmpty(); } -QString PropertyValueContainer::dynamicTypeName() const +TypeName PropertyValueContainer::dynamicTypeName() const { return m_dynamicTypeName; } diff --git a/share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.h b/share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.h index c967a69834..a13e7cb9ea 100644 --- a/share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.h +++ b/share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.h @@ -35,8 +35,9 @@ #include <QVariant> #include <QString> -namespace QmlDesigner { +#include "nodeinstanceglobal.h" +namespace QmlDesigner { class PropertyValueContainer { @@ -44,19 +45,19 @@ class PropertyValueContainer public: PropertyValueContainer(); - PropertyValueContainer(qint32 instanceId, const QString &name, const QVariant &value, const QString &dynamicTypeName); + PropertyValueContainer(qint32 instanceId, const PropertyName &name, const QVariant &value, const TypeName &dynamicTypeName); qint32 instanceId() const; - QString name() const; + PropertyName name() const; QVariant value() const; bool isDynamic() const; - QString dynamicTypeName() const; + TypeName dynamicTypeName() const; private: qint32 m_instanceId; - QString m_name; + PropertyName m_name; QVariant m_value; - QString m_dynamicTypeName; + TypeName m_dynamicTypeName; }; QDataStream &operator<<(QDataStream &out, const PropertyValueContainer &container); diff --git a/share/qtcreator/qml/qmlpuppet/container/reparentcontainer.cpp b/share/qtcreator/qml/qmlpuppet/container/reparentcontainer.cpp index 711b0dc793..a313a411b8 100644 --- a/share/qtcreator/qml/qmlpuppet/container/reparentcontainer.cpp +++ b/share/qtcreator/qml/qmlpuppet/container/reparentcontainer.cpp @@ -42,9 +42,9 @@ ReparentContainer::ReparentContainer() ReparentContainer::ReparentContainer(qint32 instanceId, qint32 oldParentInstanceId, - const QString &oldParentProperty, + const PropertyName &oldParentProperty, qint32 newParentInstanceId, - const QString &newParentProperty) + const PropertyName &newParentProperty) : m_instanceId(instanceId), m_oldParentInstanceId(oldParentInstanceId), m_oldParentProperty(oldParentProperty), @@ -63,7 +63,7 @@ qint32 ReparentContainer::oldParentInstanceId() const return m_oldParentInstanceId; } -QString ReparentContainer::oldParentProperty() const +PropertyName ReparentContainer::oldParentProperty() const { return m_oldParentProperty; } @@ -73,7 +73,7 @@ qint32 ReparentContainer::newParentInstanceId() const return m_newParentInstanceId; } -QString ReparentContainer::newParentProperty() const +PropertyName ReparentContainer::newParentProperty() const { return m_newParentProperty; } diff --git a/share/qtcreator/qml/qmlpuppet/container/reparentcontainer.h b/share/qtcreator/qml/qmlpuppet/container/reparentcontainer.h index db2e1872cd..94c3b56a22 100644 --- a/share/qtcreator/qml/qmlpuppet/container/reparentcontainer.h +++ b/share/qtcreator/qml/qmlpuppet/container/reparentcontainer.h @@ -34,6 +34,8 @@ #include <QString> #include <QDataStream> +#include "nodeinstanceglobal.h" + namespace QmlDesigner { class ReparentContainer @@ -43,22 +45,22 @@ public: ReparentContainer(); ReparentContainer(qint32 instanceId, qint32 oldParentInstanceId, - const QString &oldParentProperty, + const PropertyName &oldParentProperty, qint32 newParentInstanceId, - const QString &newParentProperty); + const PropertyName &newParentProperty); qint32 instanceId() const; qint32 oldParentInstanceId() const; - QString oldParentProperty() const; + PropertyName oldParentProperty() const; qint32 newParentInstanceId() const; - QString newParentProperty() const; + PropertyName newParentProperty() const; private: qint32 m_instanceId; qint32 m_oldParentInstanceId; - QString m_oldParentProperty; + PropertyName m_oldParentProperty; qint32 m_newParentInstanceId; - QString m_newParentProperty; + PropertyName m_newParentProperty; }; QDataStream &operator<<(QDataStream &out, const ReparentContainer &container); diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/interfaces.pri b/share/qtcreator/qml/qmlpuppet/interfaces/interfaces.pri index 4e64200029..76a778cc51 100644 --- a/share/qtcreator/qml/qmlpuppet/interfaces/interfaces.pri +++ b/share/qtcreator/qml/qmlpuppet/interfaces/interfaces.pri @@ -1,6 +1,7 @@ INCLUDEPATH += $$PWD/ HEADERS += $$PWD/nodeinstanceclientinterface.h +HEADERS += $$PWD/interfaces/nodeinstanceglobal.h HEADERS += $$PWD/nodeinstanceserverinterface.h HEADERS += $$PWD/commondefines.h diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceglobal.h b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceglobal.h new file mode 100644 index 0000000000..02c45362ba --- /dev/null +++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceglobal.h @@ -0,0 +1,11 @@ +#ifndef NODEINSTANCEGLOBAL_H +#define NODEINSTANCEGLOBAL_H + +namespace QmlDesigner { + +typedef QByteArray PropertyName; +typedef QList<PropertyName> PropertyNameList; +typedef QByteArray TypeName; +} + +#endif // NODEINSTANCEGLOBAL_H diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/behaviornodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/behaviornodeinstance.cpp index 63b148cff4..e973fa9513 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/behaviornodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/behaviornodeinstance.cpp @@ -55,7 +55,7 @@ BehaviorNodeInstance::Pointer BehaviorNodeInstance::create(QObject *object) return instance; } -void BehaviorNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void BehaviorNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { if (name == "enabled") return; @@ -63,7 +63,7 @@ void BehaviorNodeInstance::setPropertyVariant(const QString &name, const QVarian ObjectNodeInstance::setPropertyVariant(name, value); } -void BehaviorNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void BehaviorNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { if (name == "enabled") return; @@ -71,7 +71,7 @@ void BehaviorNodeInstance::setPropertyBinding(const QString &name, const QString ObjectNodeInstance::setPropertyBinding(name, expression); } -QVariant BehaviorNodeInstance::property(const QString &name) const +QVariant BehaviorNodeInstance::property(const PropertyName &name) const { if (name == "enabled") return QVariant::fromValue(m_isEnabled); @@ -79,7 +79,7 @@ QVariant BehaviorNodeInstance::property(const QString &name) const return ObjectNodeInstance::property(name); } -void BehaviorNodeInstance::resetProperty(const QString &name) +void BehaviorNodeInstance::resetProperty(const PropertyName &name) { if (name == "enabled") m_isEnabled = true; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/behaviornodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/behaviornodeinstance.h index 91dc0cef70..0cc6d68891 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/behaviornodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/behaviornodeinstance.h @@ -45,12 +45,12 @@ public: static Pointer create(QObject *objectToBeWrapped); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyBinding(const PropertyName &name, const QString &expression); - QVariant property(const QString &name) const; - void resetProperty(const QString &name); + QVariant property(const PropertyName &name) const; + void resetProperty(const PropertyName &name); private: bool m_isEnabled; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancemetaobject.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancemetaobject.cpp index 4c6fd52588..f4697830e1 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancemetaobject.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancemetaobject.cpp @@ -120,7 +120,7 @@ NodeInstanceMetaObject *NodeInstanceMetaObject::createNodeInstanceMetaObject(con return new NodeInstanceMetaObject(nodeInstance, engine); } -NodeInstanceMetaObject *NodeInstanceMetaObject::createNodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const QString &prefix, QQmlEngine *engine) +NodeInstanceMetaObject *NodeInstanceMetaObject::createNodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const PropertyName &prefix, QQmlEngine *engine) { //Avoid setting up multiple NodeInstanceMetaObjects on the same QObject QObjectPrivate *op = QObjectPrivate::get(nodeInstance->object()); @@ -175,7 +175,7 @@ NodeInstanceMetaObject::NodeInstanceMetaObject(const ObjectNodeInstance::Pointer } -NodeInstanceMetaObject::NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const QString &prefix, QQmlEngine *engine) +NodeInstanceMetaObject::NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const PropertyName &prefix, QQmlEngine *engine) : QQmlVMEMetaObject(object, cacheForObject(object, engine), vMEMetaDataForObject(object)), m_nodeInstance(nodeInstance), m_prefix(prefix), @@ -199,7 +199,7 @@ NodeInstanceMetaObject::~NodeInstanceMetaObject() void NodeInstanceMetaObject::createNewProperty(const QString &name) { - int id = createProperty(name.toLatin1(), 0); + int id = createProperty(name.toUtf8(), 0); setValue(id, QVariant()); Q_ASSERT(id >= 0); Q_UNUSED(id); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancemetaobject.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancemetaobject.h index 4c55688365..7be3f6b39d 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancemetaobject.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancemetaobject.h @@ -35,7 +35,10 @@ #include <private/qqmlopenmetaobject_p.h> #include <private/qqmlvmemetaobject_p.h> +#include "nodeinstanceglobal.h" + namespace QmlDesigner { + namespace Internal { class ObjectNodeInstance; @@ -48,13 +51,13 @@ class NodeInstanceMetaObject : public QQmlVMEMetaObject { public: static NodeInstanceMetaObject *createNodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QQmlEngine *engine); - static NodeInstanceMetaObject *createNodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const QString &prefix, QQmlEngine *engine); + static NodeInstanceMetaObject *createNodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const PropertyName &prefix, QQmlEngine *engine); ~NodeInstanceMetaObject(); void createNewProperty(const QString &name); protected: NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QQmlEngine *engine); - NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const QString &prefix, QQmlEngine *engine); + NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const PropertyName &prefix, QQmlEngine *engine); int openMetaCall(QMetaObject::Call _c, int _id, void **_a); int metaCall(QMetaObject::Call _c, int _id, void **_a); @@ -93,7 +96,7 @@ private: void init(QObject *, QQmlEngine *engine); ObjectNodeInstanceWeakPointer m_nodeInstance; - QString m_prefix; + PropertyName m_prefix; QPointer<QQmlContext> m_context; QQmlOpenMetaObjectType *m_type; QScopedPointer<MetaPropertyData> m_data; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp index 794f46a495..fe4ba68487 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -661,7 +661,7 @@ Internal::ChildrenChangeEventFilter *NodeInstanceServer::childrenChangeEventFilt return m_childrenChangeEventFilter.data(); } -void NodeInstanceServer::addFilePropertyToFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path) +void NodeInstanceServer::addFilePropertyToFileSystemWatcher(QObject *object, const PropertyName &propertyName, const QString &path) { if (!m_fileSystemWatcherHash.contains(path)) { m_fileSystemWatcherHash.insert(path, ObjectPropertyPair(object, propertyName)); @@ -669,7 +669,7 @@ void NodeInstanceServer::addFilePropertyToFileSystemWatcher(QObject *object, con } } -void NodeInstanceServer::removeFilePropertyFromFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path) +void NodeInstanceServer::removeFilePropertyFromFileSystemWatcher(QObject *object, const PropertyName &propertyName, const QString &path) { if (m_fileSystemWatcherHash.contains(path)) { fileSystemWatcher()->removePath(path); @@ -682,7 +682,7 @@ void NodeInstanceServer::refreshLocalFileProperty(const QString &path) if (m_fileSystemWatcherHash.contains(path)) { foreach (const ObjectPropertyPair &objectPropertyPair, m_fileSystemWatcherHash) { QObject *object = objectPropertyPair.first.data(); - QString propertyName = objectPropertyPair.second; + PropertyName propertyName = objectPropertyPair.second; if (hasInstanceForObject(object)) { instanceForObject(object).refreshProperty(propertyName); @@ -734,7 +734,7 @@ void NodeInstanceServer::resetInstanceProperty(const PropertyAbstractContainer & ServerNodeInstance instance = instanceForId(propertyContainer.instanceId()); Q_ASSERT(instance.isValid()); - const QString name = propertyContainer.name(); + const PropertyName name = propertyContainer.name(); if (activeStateInstance().isValid() && !instance.isSubclassOf("QtQuick/PropertyChanges")) { bool statePropertyWasReseted = activeStateInstance().resetStateProperty(instance, name, instance.resetVariant(name)); @@ -755,7 +755,7 @@ void NodeInstanceServer::setInstancePropertyBinding(const PropertyBindingContain if (hasInstanceForId(bindingContainer.instanceId())) { ServerNodeInstance instance = instanceForId(bindingContainer.instanceId()); - const QString name = bindingContainer.name(); + const PropertyName name = bindingContainer.name(); const QString expression = bindingContainer.expression(); @@ -789,7 +789,7 @@ void NodeInstanceServer::setInstancePropertyVariant(const PropertyValueContainer ServerNodeInstance instance = instanceForId(valueContainer.instanceId()); - const QString name = valueContainer.name(); + const PropertyName name = valueContainer.name(); const QVariant value = valueContainer.value(); @@ -816,8 +816,8 @@ void NodeInstanceServer::setInstancePropertyVariant(const PropertyValueContainer void NodeInstanceServer::setInstanceAuxiliaryData(const PropertyValueContainer &auxiliaryContainer) { //instanceId() == 0: the item is root - if (auxiliaryContainer.instanceId() == 0 && (auxiliaryContainer.name() == QLatin1String("width") || - auxiliaryContainer.name() == QLatin1String("height"))) { + if (auxiliaryContainer.instanceId() == 0 && (auxiliaryContainer.name() == "width" || + auxiliaryContainer.name() == "height")) { if (!auxiliaryContainer.value().isNull()) { setInstancePropertyVariant(auxiliaryContainer); @@ -825,8 +825,8 @@ void NodeInstanceServer::setInstanceAuxiliaryData(const PropertyValueContainer & rootNodeInstance().resetProperty(auxiliaryContainer.name()); } } - if (auxiliaryContainer.name().endsWith(QLatin1String("@NodeInstance"))) { - QString propertyName = auxiliaryContainer.name().leftRef(auxiliaryContainer.name().count() - 12).toString(); + if (auxiliaryContainer.name().endsWith("@NodeInstance")) { + PropertyName propertyName = auxiliaryContainer.name().left(auxiliaryContainer.name().count() - 12); if (!auxiliaryContainer.value().isNull()) { setInstancePropertyVariant(PropertyValueContainer(auxiliaryContainer.instanceId(), propertyName, @@ -897,51 +897,51 @@ static QVector<InformationContainer> createInformationVector(const QList<ServerN informationVector.append(InformationContainer(instance.instanceId(), IsAnchoredByChildren, instance.isAnchoredByChildren())); informationVector.append(InformationContainer(instance.instanceId(), IsAnchoredBySibling, instance.isAnchoredBySibling())); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.fill"), instance.hasAnchor("anchors.fill"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.centerIn"), instance.hasAnchor("anchors.centerIn"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.right"), instance.hasAnchor("anchors.right"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.top"), instance.hasAnchor("anchors.top"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.left"), instance.hasAnchor("anchors.left"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.bottom"), instance.hasAnchor("anchors.bottom"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.horizontalCenter"), instance.hasAnchor("anchors.horizontalCenter"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.verticalCenter"), instance.hasAnchor("anchors.verticalCenter"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.baseline"), instance.hasAnchor("anchors.baseline"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.fill"), instance.hasAnchor("anchors.fill"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.centerIn"), instance.hasAnchor("anchors.centerIn"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.right"), instance.hasAnchor("anchors.right"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.top"), instance.hasAnchor("anchors.top"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.left"), instance.hasAnchor("anchors.left"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.bottom"), instance.hasAnchor("anchors.bottom"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.horizontalCenter"), instance.hasAnchor("anchors.horizontalCenter"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.verticalCenter"), instance.hasAnchor("anchors.verticalCenter"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.baseline"), instance.hasAnchor("anchors.baseline"))); - QPair<QString, ServerNodeInstance> anchorPair = instance.anchor("anchors.fill"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.fill"), anchorPair.first, anchorPair.second.instanceId())); + QPair<PropertyName, ServerNodeInstance> anchorPair = instance.anchor("anchors.fill"); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.fill"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.centerIn"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.centerIn"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.centerIn"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.right"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.right"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.right"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.top"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.top"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.top"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.left"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.left"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.left"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.bottom"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.bottom"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.bottom"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.horizontalCenter"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.horizontalCenter"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.horizontalCenter"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.verticalCenter"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.verticalCenter"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.verticalCenter"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.baseline"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.baseline"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.baseline"), anchorPair.first, anchorPair.second.instanceId())); - QStringList propertyNames = instance.propertyNames(); + PropertyNameList propertyNames = instance.propertyNames(); if (initial) { - foreach (const QString &propertyName,propertyNames) + foreach (const PropertyName &propertyName,propertyNames) informationVector.append(InformationContainer(instance.instanceId(), InstanceTypeForProperty, propertyName, instance.instanceType(propertyName))); } - foreach (const QString &propertyName,instance.propertyNames()) { + foreach (const PropertyName &propertyName,instance.propertyNames()) { bool hasChanged = false; bool hasBinding = instance.hasBindingForProperty(propertyName, &hasChanged); if (hasChanged) @@ -979,10 +979,10 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QList< QVector<PropertyValueContainer> valueVector; foreach (const ServerNodeInstance &instance, instanceList) { - foreach (const QString &propertyName, instance.propertyNames()) { + foreach (const PropertyName &propertyName, instance.propertyNames()) { QVariant propertyValue = instance.property(propertyName); if (supportedVariantType(propertyValue.userType())) - valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, QString())); + valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, PropertyName())); } } @@ -1005,13 +1005,13 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVecto QVector<PropertyValueContainer> valueVector; foreach (const InstancePropertyPair &property, propertyList) { - const QString propertyName = property.second; + const PropertyName propertyName = property.second; const ServerNodeInstance instance = property.first; if (instance.isValid()) { QVariant propertyValue = instance.property(propertyName); if (QMetaType::isRegistered(propertyValue.userType()) && supportedVariantType(propertyValue.type())) { - valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, QString())); + valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, PropertyName())); } } } @@ -1034,7 +1034,7 @@ QObject *NodeInstanceServer::dummyContextObject() const return m_dummyContextObject.data(); } -void NodeInstanceServer::notifyPropertyChange(qint32 instanceid, const QString &propertyName) +void NodeInstanceServer::notifyPropertyChange(qint32 instanceid, const PropertyName &propertyName) { if (hasInstanceForId(instanceid)) addChangedProperty(InstancePropertyPair(instanceForId(instanceid), propertyName)); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h index b56da8dfa5..82b1670e50 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h @@ -68,9 +68,9 @@ class NodeInstanceServer : public NodeInstanceServerInterface { Q_OBJECT public: - typedef QPair<QPointer<QObject>, QString> ObjectPropertyPair; + typedef QPair<QPointer<QObject>, PropertyName> ObjectPropertyPair; typedef QPair<qint32, QString> IdPropertyPair; - typedef QPair<ServerNodeInstance, QString> InstancePropertyPair; + typedef QPair<ServerNodeInstance, PropertyName> InstancePropertyPair; typedef QPair<QString, QPointer<QObject> > DummyPair; explicit NodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient); @@ -107,8 +107,8 @@ public: QFileSystemWatcher *fileSystemWatcher(); QFileSystemWatcher *dummydataFileSystemWatcher(); Internal::ChildrenChangeEventFilter *childrenChangeEventFilter() const; - void addFilePropertyToFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path); - void removeFilePropertyFromFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path); + void addFilePropertyToFileSystemWatcher(QObject *object, const PropertyName &propertyName, const QString &path); + void removeFilePropertyFromFileSystemWatcher(QObject *object, const PropertyName &propertyName, const QString &path); QUrl fileUrl() const; @@ -118,7 +118,7 @@ public: ServerNodeInstance rootNodeInstance() const; - void notifyPropertyChange(qint32 instanceid, const QString &propertyName); + void notifyPropertyChange(qint32 instanceid, const PropertyName &propertyName); QStringList imports() const; QObject *dummyContextObject() const; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.cpp index 35c5c044d7..2dc2367cf0 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.cpp @@ -53,7 +53,7 @@ void NodeInstanceSignalSpy::setObjectNodeInstance(const ObjectNodeInstance::Poin } -void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString &prefix) +void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const PropertyName &prefix) { if (m_registeredObjectList.contains(spiedObject)) // prevent cycles return; @@ -70,7 +70,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString & && QQmlMetaType::isQObject(metaProperty.userType())) { QObject *propertyObject = QQmlMetaType::toQObject(metaProperty.read(spiedObject)); if (propertyObject) - registerObject(propertyObject, prefix + metaProperty.name() + QLatin1Char('.')); + registerObject(propertyObject, prefix + metaProperty.name() + '.'); } else if (metaProperty.hasNotifySignal()) { QMetaMethod metaMethod = metaProperty.notifySignal(); bool isConnecting = QMetaObject::connect(spiedObject, metaMethod.methodIndex(), this, methodeOffset, Qt::DirectConnection); @@ -86,7 +86,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString & && QQmlMetaType::isQObject(metaProperty.userType())) { QObject *propertyObject = QQmlMetaType::toQObject(metaProperty.read(spiedObject)); if (propertyObject) - registerObject(propertyObject, prefix + metaProperty.name() + QLatin1Char('/')); + registerObject(propertyObject, prefix + metaProperty.name() + '/'); } // search recursive in objects list @@ -99,7 +99,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString & for (int i = 0; i < list.count(); i++) { QObject *propertyObject = list.at(i); if (propertyObject) - registerObject(propertyObject, prefix + metaProperty.name() + QLatin1Char('/')); + registerObject(propertyObject, prefix + metaProperty.name() + '/'); } } } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.h index 6f8bdacdf8..8c1bb7c059 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.h @@ -34,7 +34,10 @@ #include <QHash> #include <QSharedPointer> +#include "nodeinstanceglobal.h" + namespace QmlDesigner { + namespace Internal { class ObjectNodeInstance; @@ -51,11 +54,11 @@ public: virtual int qt_metacall(QMetaObject::Call, int, void **); protected: - void registerObject(QObject *spiedObject, const QString &prefix = QString()); + void registerObject(QObject *spiedObject, const PropertyName &prefix = PropertyName()); private: int methodeOffset; - QHash<int, QString> m_indexPropertyHash; + QHash<int, PropertyName> m_indexPropertyHash; QObjectList m_registeredObjectList; ObjectNodeInstanceWeakPointer m_objectNodeInstance; }; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index fea1a5199c..b4c54a7e79 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -79,7 +79,7 @@ void ObjectNodeInstance::destroy() if (object()) { setId(QString()); if (m_instanceId >= 0) { - reparent(parentInstance(), m_parentProperty, ObjectNodeInstance::Pointer(), QString()); + reparent(parentInstance(), m_parentProperty, ObjectNodeInstance::Pointer(), PropertyName()); } } @@ -235,7 +235,7 @@ double ObjectNodeInstance::opacity() const return 1.0; } -bool ObjectNodeInstance::hasAnchor(const QString &/*name*/) const +bool ObjectNodeInstance::hasAnchor(const PropertyName &/*name*/) const { return false; } @@ -250,9 +250,9 @@ bool ObjectNodeInstance::isAnchoredByChildren() const return false; } -QPair<QString, ServerNodeInstance> ObjectNodeInstance::anchor(const QString &/*name*/) const +QPair<PropertyName, ServerNodeInstance> ObjectNodeInstance::anchor(const PropertyName &/*name*/) const { - return qMakePair(QString(), ServerNodeInstance()); + return qMakePair(PropertyName(), ServerNodeInstance()); } @@ -280,7 +280,7 @@ static bool hasFullImplementedListInterface(const QQmlListReference &list) static void removeObjectFromList(const QQmlProperty &property, QObject *objectToBeRemoved, QQmlEngine * engine) { - QQmlListReference listReference(property.object(), property.name().toLatin1(), engine); + QQmlListReference listReference(property.object(), property.name().toUtf8(), engine); if (!hasFullImplementedListInterface(listReference)) { qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; @@ -303,7 +303,7 @@ static void removeObjectFromList(const QQmlProperty &property, QObject *objectTo listReference.append(object); } -void ObjectNodeInstance::removeFromOldProperty(QObject *object, QObject *oldParent, const QString &oldParentProperty) +void ObjectNodeInstance::removeFromOldProperty(QObject *object, QObject *oldParent, const PropertyName &oldParentProperty) { QQmlProperty property(oldParent, oldParentProperty, context()); @@ -322,7 +322,7 @@ void ObjectNodeInstance::removeFromOldProperty(QObject *object, QObject *oldPare object->setParent(0); } -void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, const QString &newParentProperty) +void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, const PropertyName &newParentProperty) { QQmlProperty property(newParent, newParentProperty, context()); @@ -347,7 +347,7 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c Q_ASSERT(objectToVariant(object).isValid()); } -void ObjectNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const QString &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const QString &newParentProperty) +void ObjectNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty) { if (oldParentInstance) { removeFromOldProperty(object(), oldParentInstance->object(), oldParentProperty); @@ -422,7 +422,7 @@ QVariant ObjectNodeInstance::fixResourcePaths(const QVariant &value) return value; } -void ObjectNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { QQmlProperty property(object(), name, context()); @@ -457,7 +457,7 @@ void ObjectNodeInstance::setPropertyVariant(const QString &name, const QVariant } } -void ObjectNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void ObjectNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { QQmlProperty property(object(), name, context()); @@ -500,7 +500,7 @@ void ObjectNodeInstance::deleteObjectsInList(const QQmlProperty &property) list.clear(); } -void ObjectNodeInstance::resetProperty(const QString &name) +void ObjectNodeInstance::resetProperty(const PropertyName &name) { doResetProperty(name); @@ -511,7 +511,7 @@ void ObjectNodeInstance::resetProperty(const QString &name) doResetProperty("font.pixelSize"); } -void ObjectNodeInstance::refreshProperty(const QString &name) +void ObjectNodeInstance::refreshProperty(const PropertyName &name) { QQmlProperty property(object(), name, context()); @@ -527,14 +527,14 @@ void ObjectNodeInstance::refreshProperty(const QString &name) if (oldValue.type() == QVariant::Url) { QByteArray key = oldValue.toUrl().toEncoded(QUrl::UrlFormattingOption(0x100)); - QString pixmapKey = QString::fromLatin1(key.constData(), key.count()); + QString pixmapKey = QString::fromUtf8(key.constData(), key.count()); QPixmapCache::remove(pixmapKey); } property.write(oldValue); } -bool ObjectNodeInstance::hasBindingForProperty(const QString &name, bool *hasChanged) const +bool ObjectNodeInstance::hasBindingForProperty(const PropertyName &name, bool *hasChanged) const { QQmlProperty property(object(), name, context()); @@ -549,7 +549,7 @@ bool ObjectNodeInstance::hasBindingForProperty(const QString &name, bool *hasCha return QQmlPropertyPrivate::binding(property); } -void ObjectNodeInstance::doResetProperty(const QString &propertyName) +void ObjectNodeInstance::doResetProperty(const PropertyName &propertyName) { m_modelAbstractPropertyHash.remove(propertyName); @@ -597,7 +597,7 @@ void ObjectNodeInstance::doResetProperty(const QString &propertyName) } } -QVariant ObjectNodeInstance::property(const QString &name) const +QVariant ObjectNodeInstance::property(const PropertyName &name) const { if (m_modelAbstractPropertyHash.contains(name)) return QVariant::fromValue(m_modelAbstractPropertyHash.value(name)); @@ -624,9 +624,9 @@ QVariant ObjectNodeInstance::property(const QString &name) const return property.read(); } -QStringList allPropertyNames(QObject *object, const QString &baseName = QString(), QObjectList *inspectedObjects = new QObjectList) +PropertyNameList allPropertyNames(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList) { - QStringList propertyNameList; + PropertyNameList propertyNameList; if (inspectedObjects== 0 || inspectedObjects->contains(object)) @@ -643,28 +643,28 @@ QStringList allPropertyNames(QObject *object, const QString &baseName = QString( if (declarativeProperty.name() != "parent") { QObject *childObject = QQmlMetaType::toQObject(declarativeProperty.read()); if (childObject) - propertyNameList.append(allPropertyNames(childObject, baseName + QString::fromUtf8(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(allPropertyNames(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } } else if (QQmlValueTypeFactory::valueType(metaProperty.userType())) { QQmlValueType *valueType = QQmlValueTypeFactory::valueType(metaProperty.userType()); valueType->setValue(metaProperty.read(object)); - propertyNameList.append(allPropertyNames(valueType, baseName + QString::fromUtf8(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(allPropertyNames(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } else { - propertyNameList.append(baseName + QString::fromUtf8(metaProperty.name())); + propertyNameList.append(baseName + PropertyName(metaProperty.name())); } } return propertyNameList; } -QStringList ObjectNodeInstance::propertyNames() const +PropertyNameList ObjectNodeInstance::propertyNames() const { if (isValid()) return allPropertyNames(object()); - return QStringList(); + return PropertyNameList(); } -QString ObjectNodeInstance::instanceType(const QString &name) const +QString ObjectNodeInstance::instanceType(const PropertyName &name) const { QQmlProperty property(object(), name, context()); if (!property.isValid()) @@ -785,9 +785,9 @@ static void disableTiledBackingStore(QObject *object) Q_UNUSED(object); } -QStringList propertyNameForWritableProperties(QObject *object, const QString &baseName = QString(), QObjectList *inspectedObjects = new QObjectList()) +PropertyNameList propertyNameForWritableProperties(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList()) { - QStringList propertyNameList; + PropertyNameList propertyNameList; if (inspectedObjects == 0 || inspectedObjects->contains(object)) return propertyNameList; @@ -802,16 +802,16 @@ QStringList propertyNameForWritableProperties(QObject *object, const QString &ba if (declarativeProperty.name() != "parent") { QObject *childObject = QQmlMetaType::toQObject(declarativeProperty.read()); if (childObject) - propertyNameList.append(propertyNameForWritableProperties(childObject, baseName + QString::fromUtf8(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(propertyNameForWritableProperties(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } } else if (QQmlValueTypeFactory::valueType(metaProperty.userType())) { QQmlValueType *valueType = QQmlValueTypeFactory::valueType(metaProperty.userType()); valueType->setValue(metaProperty.read(object)); - propertyNameList.append(propertyNameForWritableProperties(valueType, baseName + QString::fromUtf8(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(propertyNameForWritableProperties(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } if (metaProperty.isReadable() && metaProperty.isWritable()) { - propertyNameList.append(baseName + QString::fromUtf8(metaProperty.name())); + propertyNameList.append(baseName + PropertyName(metaProperty.name())); } } @@ -823,9 +823,9 @@ static void fixResourcePathsForObject(QObject *object) if (qgetenv("QMLDESIGNER_RC_PATHS").isEmpty()) return; - QStringList propertyNameList = propertyNameForWritableProperties(object); + PropertyNameList propertyNameList = propertyNameForWritableProperties(object); - foreach (const QString &propertyName, propertyNameList) { + foreach (const PropertyName &propertyName, propertyNameList) { QQmlProperty property(object, propertyName, QQmlEngine::contextForObject(object)); const QVariant value = property.read(); @@ -1039,9 +1039,9 @@ void ObjectNodeInstance::deactivateState() void ObjectNodeInstance::populateResetHashes() { - QStringList propertyNameList = propertyNameForWritableProperties(object()); + PropertyNameList propertyNameList = propertyNameForWritableProperties(object()); - foreach (const QString &propertyName, propertyNameList) { + foreach (const PropertyName &propertyName, propertyNameList) { QQmlProperty property(object(), propertyName, QQmlEngine::contextForObject(object())); QQmlAbstractBinding::Pointer binding = QQmlAbstractBinding::getPointer(QQmlPropertyPrivate::binding(property)); @@ -1053,22 +1053,22 @@ void ObjectNodeInstance::populateResetHashes() } } -QQmlAbstractBinding *ObjectNodeInstance::resetBinding(const QString &propertyName) const +QQmlAbstractBinding *ObjectNodeInstance::resetBinding(const PropertyName &propertyName) const { return m_resetBindingHash.value(propertyName).data(); } -bool ObjectNodeInstance::hasValidResetBinding(const QString &propertyName) const +bool ObjectNodeInstance::hasValidResetBinding(const PropertyName &propertyName) const { return m_resetBindingHash.contains(propertyName) && m_resetBindingHash.value(propertyName).data(); } -QVariant ObjectNodeInstance::resetValue(const QString &propertyName) const +QVariant ObjectNodeInstance::resetValue(const PropertyName &propertyName) const { return m_resetValueHash.value(propertyName); } -void ObjectNodeInstance::setResetValue(const QString &propertyName, const QVariant &value) +void ObjectNodeInstance::setResetValue(const PropertyName &propertyName, const QVariant &value) { m_resetValueHash.insert(propertyName, value); } @@ -1145,17 +1145,17 @@ void ObjectNodeInstance::createDynamicProperty(const QString &name, const QStrin m_metaObject->createNewProperty(name); } -bool ObjectNodeInstance::updateStateVariant(const ObjectNodeInstance::Pointer &/*target*/, const QString &/*propertyName*/, const QVariant &/*value*/) +bool ObjectNodeInstance::updateStateVariant(const ObjectNodeInstance::Pointer &/*target*/, const PropertyName &/*propertyName*/, const QVariant &/*value*/) { return false; } -bool ObjectNodeInstance::updateStateBinding(const ObjectNodeInstance::Pointer &/*target*/, const QString &/*propertyName*/, const QString &/*expression*/) +bool ObjectNodeInstance::updateStateBinding(const ObjectNodeInstance::Pointer &/*target*/, const PropertyName &/*propertyName*/, const QString &/*expression*/) { return false; } -bool ObjectNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &/*target*/, const QString &/*propertyName*/, const QVariant &/*resetValue*/) +bool ObjectNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &/*target*/, const PropertyName &/*propertyName*/, const QVariant &/*resetValue*/) { return false; } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h index 08a4b1ca22..4feb35aacc 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h @@ -90,7 +90,7 @@ public: Pointer parentInstance() const; - virtual void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const QString &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const QString &newParentProperty); + virtual void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty); virtual void setId(const QString &id); virtual QString id() const; @@ -112,8 +112,8 @@ public: virtual int penWidth() const; - virtual bool hasAnchor(const QString &name) const; - virtual QPair<QString, ServerNodeInstance> anchor(const QString &name) const; + virtual bool hasAnchor(const PropertyName &name) const; + virtual QPair<PropertyName, ServerNodeInstance> anchor(const PropertyName &name) const; virtual bool isAnchoredBySibling() const; virtual bool isAnchoredByChildren() const; @@ -123,17 +123,17 @@ public: virtual QPointF transformOriginPoint() const; virtual double zValue() const; - virtual void setPropertyVariant(const QString &name, const QVariant &value); - virtual void setPropertyBinding(const QString &name, const QString &expression); - virtual QVariant property(const QString &name) const; - virtual void resetProperty(const QString &name); - virtual void refreshProperty(const QString &name); - virtual QString instanceType(const QString &name) const; - QStringList propertyNames() const; + virtual void setPropertyVariant(const PropertyName &name, const QVariant &value); + virtual void setPropertyBinding(const PropertyName &name, const QString &expression); + virtual QVariant property(const PropertyName &name) const; + virtual void resetProperty(const PropertyName &name); + virtual void refreshProperty(const PropertyName &name); + virtual QString instanceType(const PropertyName &name) const; + PropertyNameList propertyNames() const; virtual QList<ServerNodeInstance> childItems() const; - void createDynamicProperty(const QString &name, const QString &typeName); + void createDynamicProperty(const QString &PropertyName, const QString &typeName); void setDeleteHeldInstance(bool deleteInstance); bool deleteHeldInstance() const; @@ -144,10 +144,10 @@ public: virtual void deactivateState(); void populateResetHashes(); - bool hasValidResetBinding(const QString &propertyName) const; - QQmlAbstractBinding *resetBinding(const QString &propertyName) const; - QVariant resetValue(const QString &propertyName) const; - void setResetValue(const QString &propertyName, const QVariant &value); + bool hasValidResetBinding(const PropertyName &propertyName) const; + QQmlAbstractBinding *resetBinding(const PropertyName &propertyName) const; + QVariant resetValue(const PropertyName &propertyName) const; + void setResetValue(const PropertyName &propertyName, const QVariant &value); QObject *object() const; @@ -158,14 +158,14 @@ public: void setInPositioner(bool isInPositioner); virtual void refreshPositioner(); - bool hasBindingForProperty(const QString &name, bool *hasChanged = 0) const; + bool hasBindingForProperty(const PropertyName &name, bool *hasChanged = 0) const; QQmlContext *context() const; QQmlEngine *engine() const; - virtual bool updateStateVariant(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &value); - virtual bool updateStateBinding(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QString &expression); - virtual bool resetStateProperty(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &resetValue); + virtual bool updateStateVariant(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &value); + virtual bool updateStateBinding(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QString &expression); + virtual bool resetStateProperty(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &resetValue); bool isValid() const; @@ -180,22 +180,22 @@ public: static QVariant fixResourcePaths(const QVariant &value); protected: - void doResetProperty(const QString &propertyName); - void removeFromOldProperty(QObject *object, QObject *oldParent, const QString &oldParentProperty); - void addToNewProperty(QObject *object, QObject *newParent, const QString &newParentProperty); + void doResetProperty(const PropertyName &propertyName); + void removeFromOldProperty(QObject *object, QObject *oldParent, const PropertyName &oldParentProperty); + void addToNewProperty(QObject *object, QObject *newParent, const PropertyName &newParentProperty); void deleteObjectsInList(const QQmlProperty &metaProperty); QVariant convertSpecialCharacter(const QVariant& value) const; private: - QHash<QString, QVariant> m_resetValueHash; - QHash<QString, QWeakPointer<QQmlAbstractBinding> > m_resetBindingHash; - QHash<QString, ServerNodeInstance> m_modelAbstractPropertyHash; - mutable QHash<QString, bool> m_hasBindingHash; + QHash<PropertyName, QVariant> m_resetValueHash; + QHash<PropertyName, QWeakPointer<QQmlAbstractBinding> > m_resetBindingHash; + QHash<PropertyName, ServerNodeInstance> m_modelAbstractPropertyHash; + mutable QHash<PropertyName, bool> m_hasBindingHash; qint32 m_instanceId; QString m_id; QPointer<NodeInstanceServer> m_nodeInstanceServer; - QString m_parentProperty; + PropertyName m_parentProperty; bool m_deleteHeldInstance; QPointer<QObject> m_object; NodeInstanceMetaObject *m_metaObject; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/positionernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/positionernodeinstance.cpp index 2a615f01bd..83f20fb7e4 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/positionernodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/positionernodeinstance.cpp @@ -47,7 +47,7 @@ bool PositionerNodeInstance::isResizable() const return true; } -void PositionerNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void PositionerNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { if (name == "move" || name == "add" || name == "populate") return; @@ -55,7 +55,7 @@ void PositionerNodeInstance::setPropertyVariant(const QString &name, const QVari QuickItemNodeInstance::setPropertyVariant(name, value); } -void PositionerNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void PositionerNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { if (name == "move" || name == "add" || name == "populate") return; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/positionernodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/positionernodeinstance.h index f2d1474d36..1028af42d4 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/positionernodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/positionernodeinstance.h @@ -47,8 +47,8 @@ public: static Pointer create(QObject *objectToBeWrapped); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyBinding(const PropertyName &name, const QString &expression); bool isPositioner() const; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlpropertychangesnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlpropertychangesnodeinstance.cpp index a22d3d5b44..e9a3557848 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlpropertychangesnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlpropertychangesnodeinstance.cpp @@ -61,14 +61,14 @@ QmlPropertyChangesNodeInstance::Pointer QmlPropertyChangesNodeInstance::create(Q return instance; } -void QmlPropertyChangesNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void QmlPropertyChangesNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { QMetaObject metaObject = QQuickPropertyChanges::staticMetaObject; - if (metaObject.indexOfProperty(name.toLatin1()) > 0) { // 'restoreEntryValues', 'explicit' + if (metaObject.indexOfProperty(name) > 0) { // 'restoreEntryValues', 'explicit' ObjectNodeInstance::setPropertyVariant(name, value); } else { - changesObject()->changeValue(name.toLatin1(), value); + changesObject()->changeValue(name, value); QObject *targetObject = changesObject()->object(); if (targetObject && nodeInstanceServer()->activeStateInstance().isWrappingThisObject(changesObject()->state())) { ServerNodeInstance targetInstance = nodeInstanceServer()->instanceForObject(targetObject); @@ -77,29 +77,29 @@ void QmlPropertyChangesNodeInstance::setPropertyVariant(const QString &name, con } } -void QmlPropertyChangesNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void QmlPropertyChangesNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { QMetaObject metaObject = QQuickPropertyChanges::staticMetaObject; - if (metaObject.indexOfProperty(name.toLatin1()) > 0) { // 'restoreEntryValues', 'explicit' + if (metaObject.indexOfProperty(name) > 0) { // 'restoreEntryValues', 'explicit' ObjectNodeInstance::setPropertyBinding(name, expression); } else { - changesObject()->changeExpression(name.toLatin1(), expression); + changesObject()->changeExpression(name, expression); } } -QVariant QmlPropertyChangesNodeInstance::property(const QString &name) const +QVariant QmlPropertyChangesNodeInstance::property(const PropertyName &name) const { - return changesObject()->property(name.toLatin1()); + return changesObject()->property(name); } -void QmlPropertyChangesNodeInstance::resetProperty(const QString &name) +void QmlPropertyChangesNodeInstance::resetProperty(const PropertyName &name) { - changesObject()->removeProperty(name.toLatin1()); + changesObject()->removeProperty(name); } -void QmlPropertyChangesNodeInstance::reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty) +void QmlPropertyChangesNodeInstance::reparent(const ServerNodeInstance &oldParentInstance, const PropertyName &oldParentProperty, const ServerNodeInstance &newParentInstance, const PropertyName &newParentProperty) { changesObject()->detachFromState(); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlpropertychangesnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlpropertychangesnodeinstance.h index 7e38d12071..30e2986827 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlpropertychangesnodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlpropertychangesnodeinstance.h @@ -54,13 +54,13 @@ public: static Pointer create(QObject *objectToBeWrapped); - virtual void setPropertyVariant(const QString &name, const QVariant &value); - virtual void setPropertyBinding(const QString &name, const QString &expression); - virtual QVariant property(const QString &name) const; - virtual void resetProperty(const QString &name); + virtual void setPropertyVariant(const PropertyName &name, const QVariant &value); + virtual void setPropertyBinding(const PropertyName &name, const QString &expression); + virtual QVariant property(const PropertyName &name) const; + virtual void resetProperty(const PropertyName &name); using ObjectNodeInstance::reparent; // keep the virtual reparent(...) method around - void reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty); + void reparent(const ServerNodeInstance &oldParentInstance, const PropertyName &oldParentProperty, const ServerNodeInstance &newParentInstance, const PropertyName &newParentProperty); protected: QmlPropertyChangesNodeInstance(QQuickPropertyChanges *object); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp index 54b55d8e71..22b26ee172 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp @@ -99,7 +99,7 @@ bool QmlStateNodeInstance::isStateActive() const return stateObject() && stateGroup() && stateGroup()->state() == property("name"); } -void QmlStateNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void QmlStateNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { bool hasParent = parent(); bool isStateOfTheRootModelNode = parentInstance() && parentInstance()->isRootNodeInstance(); @@ -109,7 +109,7 @@ void QmlStateNodeInstance::setPropertyVariant(const QString &name, const QVarian ObjectNodeInstance::setPropertyVariant(name, value); } -void QmlStateNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void QmlStateNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { bool hasParent = parent(); bool isStateOfTheRootModelNode = parentInstance() && parentInstance()->isRootNodeInstance(); @@ -119,19 +119,19 @@ void QmlStateNodeInstance::setPropertyBinding(const QString &name, const QString ObjectNodeInstance::setPropertyBinding(name, expression); } -bool QmlStateNodeInstance::updateStateVariant(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &value) +bool QmlStateNodeInstance::updateStateVariant(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &value) { - return stateObject()->changeValueInRevertList(target->object(), propertyName.toLatin1(), value); + return stateObject()->changeValueInRevertList(target->object(), QString::fromUtf8(propertyName), value); } -bool QmlStateNodeInstance::updateStateBinding(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QString &expression) +bool QmlStateNodeInstance::updateStateBinding(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QString &expression) { - return stateObject()->changeValueInRevertList(target->object(), propertyName.toLatin1(), expression); + return stateObject()->changeValueInRevertList(target->object(), QString::fromUtf8(propertyName), expression); } -bool QmlStateNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant & /* resetValue */) +bool QmlStateNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant & /* resetValue */) { - return stateObject()->removeEntryFromRevertList(target->object(), propertyName.toLatin1()); + return stateObject()->removeEntryFromRevertList(target->object(), QString::fromUtf8(propertyName)); } } // namespace Internal diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.h index fe319431a9..78a759f1df 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.h @@ -48,15 +48,15 @@ public: static Pointer create(QObject *objectToBeWrapped); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyBinding(const PropertyName &name, const QString &expression); void activateState(); void deactivateState(); - bool updateStateVariant(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &value); - bool updateStateBinding(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QString &expression); - bool resetStateProperty(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &resetValue); + bool updateStateVariant(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &value); + bool updateStateBinding(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QString &expression); + bool resetStateProperty(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &resetValue); protected: diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmltransitionnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmltransitionnodeinstance.cpp index c945fcab7c..3243450e0e 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmltransitionnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmltransitionnodeinstance.cpp @@ -59,7 +59,7 @@ bool QmlTransitionNodeInstance::isTransition() const return true; } -void QmlTransitionNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void QmlTransitionNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { if (name == "from" || name == "to") return; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmltransitionnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmltransitionnodeinstance.h index cbfc595642..d12e367abd 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmltransitionnodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmltransitionnodeinstance.h @@ -47,7 +47,7 @@ public: static Pointer create(QObject *objectToBeWrapped); - void setPropertyVariant(const QString &name, const QVariant &value); + void setPropertyVariant(const PropertyName &name, const QVariant &value); bool isTransition() const; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp index 2a3bbb540a..f4db8ed8fc 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp @@ -353,7 +353,7 @@ QRectF QuickItemNodeInstance::boundingRect() const return QRectF(); } -void QuickItemNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { if (name == "state") return; // states are only set by us @@ -390,7 +390,7 @@ void QuickItemNodeInstance::setPropertyVariant(const QString &name, const QVaria parentInstance()->refreshPositioner(); } -void QuickItemNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { if (name == "state") return; // states are only set by us @@ -405,7 +405,7 @@ void QuickItemNodeInstance::setPropertyBinding(const QString &name, const QStrin parentInstance()->refreshPositioner(); } -QVariant QuickItemNodeInstance::property(const QString &name) const +QVariant QuickItemNodeInstance::property(const PropertyName &name) const { return ObjectNodeInstance::property(name); } @@ -486,7 +486,7 @@ int QuickItemNodeInstance::penWidth() const return DesignerSupport::borderWidth(quickItem()); } -void QuickItemNodeInstance::resetProperty(const QString &name) +void QuickItemNodeInstance::resetProperty(const PropertyName &name) { if (name == "height") { m_hasHeight = false; @@ -536,7 +536,7 @@ void QuickItemNodeInstance::resetProperty(const QString &name) parentInstance()->refreshPositioner(); } -void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const QString &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const QString &newParentProperty) +void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty) { if (oldParentInstance && oldParentInstance->isPositioner()) { setInPositioner(false); @@ -565,9 +565,9 @@ void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParen parentInstance()->refreshPositioner(); } -static bool isValidAnchorName(const QString &name) +static bool isValidAnchorName(const PropertyName &name) { - static QStringList anchorNameList(QStringList() << "anchors.top" + static PropertyNameList anchorNameList(PropertyNameList() << "anchors.top" << "anchors.left" << "anchors.right" << "anchors.bottom" @@ -580,12 +580,12 @@ static bool isValidAnchorName(const QString &name) return anchorNameList.contains(name); } -bool QuickItemNodeInstance::hasAnchor(const QString &name) const +bool QuickItemNodeInstance::hasAnchor(const PropertyName &name) const { return DesignerSupport::hasAnchor(quickItem(), name); } -QPair<QString, ServerNodeInstance> QuickItemNodeInstance::anchor(const QString &name) const +QPair<PropertyName, ServerNodeInstance> QuickItemNodeInstance::anchor(const PropertyName &name) const { if (!isValidAnchorName(name) || !DesignerSupport::hasAnchor(quickItem(), name)) return ObjectNodeInstance::anchor(name); @@ -593,7 +593,7 @@ QPair<QString, ServerNodeInstance> QuickItemNodeInstance::anchor(const QString & QPair<QString, QObject*> nameObjectPair = DesignerSupport::anchorLineTarget(quickItem(), name, context()); QObject *targetObject = nameObjectPair.second; - QString targetName = nameObjectPair.first; + PropertyName targetName = nameObjectPair.first.toUtf8(); if (targetObject && nodeInstanceServer()->hasInstanceForObject(targetObject)) { return qMakePair(targetName, nodeInstanceServer()->instanceForObject(targetObject)); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h index ad2f4822e2..7ac8a9f4ae 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h @@ -78,18 +78,18 @@ public: bool isMovable() const; void setMovable(bool movable); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyBinding(const PropertyName &name, const QString &expression); - QVariant property(const QString &name) const; - void resetProperty(const QString &name); + QVariant property(const PropertyName &name) const; + void resetProperty(const PropertyName &name); - void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const QString &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const QString &newParentProperty); + void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty); int penWidth() const; - bool hasAnchor(const QString &name) const; - QPair<QString, ServerNodeInstance> anchor(const QString &name) const; + bool hasAnchor(const PropertyName &name) const; + QPair<PropertyName, ServerNodeInstance> anchor(const PropertyName &name) const; bool isAnchoredBySibling() const; bool isAnchoredByChildren() const; void doComponentComplete(); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp index daf76c3117..0250e77b14 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp @@ -246,7 +246,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe return instance; } -void ServerNodeInstance::reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty) +void ServerNodeInstance::reparent(const ServerNodeInstance &oldParentInstance, const PropertyName &oldParentProperty, const ServerNodeInstance &newParentInstance, const PropertyName &newParentProperty) { m_nodeInstance->reparent(oldParentInstance.m_nodeInstance, oldParentProperty, newParentInstance.m_nodeInstance, newParentProperty); } @@ -303,35 +303,35 @@ QRectF ServerNodeInstance::boundingRect() const return boundingRect; } -void ServerNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void ServerNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { m_nodeInstance->setPropertyVariant(name, value); } -void ServerNodeInstance::setPropertyDynamicVariant(const QString &name, const QString &typeName, const QVariant &value) +void ServerNodeInstance::setPropertyDynamicVariant(const PropertyName &name, const TypeName &typeName, const QVariant &value) { m_nodeInstance->createDynamicProperty(name, typeName); m_nodeInstance->setPropertyVariant(name, value); } -void ServerNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void ServerNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { m_nodeInstance->setPropertyBinding(name, expression); } -void ServerNodeInstance::setPropertyDynamicBinding(const QString &name, const QString &typeName, const QString &expression) +void ServerNodeInstance::setPropertyDynamicBinding(const PropertyName &name, const TypeName &typeName, const QString &expression) { m_nodeInstance->createDynamicProperty(name, typeName); m_nodeInstance->setPropertyBinding(name, expression); } -void ServerNodeInstance::resetProperty(const QString &name) +void ServerNodeInstance::resetProperty(const PropertyName &name) { m_nodeInstance->resetProperty(name); } -void ServerNodeInstance::refreshProperty(const QString &name) +void ServerNodeInstance::refreshProperty(const PropertyName &name) { m_nodeInstance->refreshProperty(name); } @@ -345,17 +345,17 @@ void ServerNodeInstance::setId(const QString &id) \brief Returns the property value of the property of this NodeInstance. \returns QVariant value */ -QVariant ServerNodeInstance::property(const QString &name) const +QVariant ServerNodeInstance::property(const PropertyName &name) const { return m_nodeInstance->property(name); } -QStringList ServerNodeInstance::propertyNames() const +PropertyNameList ServerNodeInstance::propertyNames() const { return m_nodeInstance->propertyNames(); } -bool ServerNodeInstance::hasBindingForProperty(const QString &name, bool *hasChanged) const +bool ServerNodeInstance::hasBindingForProperty(const PropertyName &name, bool *hasChanged) const { return m_nodeInstance->hasBindingForProperty(name, hasChanged); } @@ -364,7 +364,7 @@ bool ServerNodeInstance::hasBindingForProperty(const QString &name, bool *hasCha \brief Returns the property default value of the property of this NodeInstance. \returns QVariant default value which is the reset value to */ -QVariant ServerNodeInstance::defaultValue(const QString &name) const +QVariant ServerNodeInstance::defaultValue(const PropertyName &name) const { return m_nodeInstance->resetValue(name); } @@ -372,7 +372,7 @@ QVariant ServerNodeInstance::defaultValue(const QString &name) const /*! \brief Returns the type of the property of this NodeInstance. */ -QString ServerNodeInstance::instanceType(const QString &name) const +QString ServerNodeInstance::instanceType(const PropertyName &name) const { return m_nodeInstance->instanceType(name); } @@ -404,7 +404,7 @@ bool ServerNodeInstance::isInPositioner() const return m_nodeInstance->isInPositioner(); } -bool ServerNodeInstance::hasAnchor(const QString &name) const +bool ServerNodeInstance::hasAnchor(const PropertyName &name) const { return m_nodeInstance->hasAnchor(name); } @@ -424,7 +424,7 @@ bool ServerNodeInstance::isAnchoredByChildren() const return m_nodeInstance->isAnchoredByChildren(); } -QPair<QString, ServerNodeInstance> ServerNodeInstance::anchor(const QString &name) const +QPair<PropertyName, ServerNodeInstance> ServerNodeInstance::anchor(const PropertyName &name) const { return m_nodeInstance->anchor(name); } @@ -569,22 +569,22 @@ void ServerNodeInstance::deactivateState() m_nodeInstance->deactivateState(); } -bool ServerNodeInstance::updateStateVariant(const ServerNodeInstance &target, const QString &propertyName, const QVariant &value) +bool ServerNodeInstance::updateStateVariant(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &value) { return m_nodeInstance->updateStateVariant(target.internalInstance(), propertyName, value); } -bool ServerNodeInstance::updateStateBinding(const ServerNodeInstance &target, const QString &propertyName, const QString &expression) +bool ServerNodeInstance::updateStateBinding(const ServerNodeInstance &target, const PropertyName &propertyName, const QString &expression) { return m_nodeInstance->updateStateBinding(target.internalInstance(), propertyName, expression); } -QVariant ServerNodeInstance::resetVariant(const QString &propertyName) const +QVariant ServerNodeInstance::resetVariant(const PropertyName &propertyName) const { return m_nodeInstance->resetValue(propertyName); } -bool ServerNodeInstance::resetStateProperty(const ServerNodeInstance &target, const QString &propertyName, const QVariant &resetValue) +bool ServerNodeInstance::resetStateProperty(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &resetValue) { return m_nodeInstance->resetStateProperty(target.internalInstance(), propertyName, resetValue); } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h index 85307a94a7..a230e6f1d9 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h @@ -117,13 +117,13 @@ public: double zValue() const; double opacity() const; - QVariant property(const QString &name) const; - QVariant defaultValue(const QString &name) const; - QString instanceType(const QString &name) const; - QStringList propertyNames() const; + QVariant property(const PropertyName &name) const; + QVariant defaultValue(const PropertyName &name) const; + QString instanceType(const PropertyName &name) const; + PropertyNameList propertyNames() const; - bool hasBindingForProperty(const QString &name, bool *hasChanged = 0) const; + bool hasBindingForProperty(const PropertyName &name, bool *hasChanged = 0) const; bool isValid() const; void makeInvalid(); @@ -137,12 +137,12 @@ public: bool isWrappingThisObject(QObject *object) const; - QVariant resetVariant(const QString &name) const; + QVariant resetVariant(const PropertyName &name) const; - bool hasAnchor(const QString &name) const; + bool hasAnchor(const PropertyName &name) const; bool isAnchoredBySibling() const; bool isAnchoredByChildren() const; - QPair<QString, ServerNodeInstance> anchor(const QString &name) const; + QPair<PropertyName, ServerNodeInstance> anchor(const PropertyName &name) const; int penWidth() const; @@ -163,27 +163,27 @@ public: private: // functions ServerNodeInstance(const QSharedPointer<Internal::ObjectNodeInstance> &abstractInstance); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyDynamicVariant(const QString &name, const QString &typeName, const QVariant &value); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyDynamicVariant(const PropertyName &name, const TypeName &typeName, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); - void setPropertyDynamicBinding(const QString &name, const QString &typeName, const QString &expression); + void setPropertyBinding(const PropertyName &name, const QString &expression); + void setPropertyDynamicBinding(const PropertyName &name, const TypeName &typeName, const QString &expression); - void resetProperty(const QString &name); - void refreshProperty(const QString &name); + void resetProperty(const PropertyName &name); + void refreshProperty(const PropertyName &name); void activateState(); void deactivateState(); void refreshState(); - bool updateStateVariant(const ServerNodeInstance &target, const QString &propertyName, const QVariant &value); - bool updateStateBinding(const ServerNodeInstance &target, const QString &propertyName, const QString &expression); - bool resetStateProperty(const ServerNodeInstance &target, const QString &propertyName, const QVariant &resetValue); + bool updateStateVariant(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &value); + bool updateStateBinding(const ServerNodeInstance &target, const PropertyName &propertyName, const QString &expression); + bool resetStateProperty(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &resetValue); static ServerNodeInstance create(NodeInstanceServer *nodeInstanceServer, const InstanceContainer &instanceContainer, ComponentWrap componentWrap); void setDeleteHeldInstance(bool deleteInstance); - void reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty); + void reparent(const ServerNodeInstance &oldParentInstance, const PropertyName &oldParentProperty, const ServerNodeInstance &newParentInstance, const PropertyName &newParentProperty); void setId(const QString &id); diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/behaviornodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/behaviornodeinstance.cpp index f8274db062..3e4927ffd4 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/behaviornodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/behaviornodeinstance.cpp @@ -55,7 +55,7 @@ BehaviorNodeInstance::Pointer BehaviorNodeInstance::create(QObject *object) return instance; } -void BehaviorNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void BehaviorNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { if (name == "enabled") return; @@ -63,7 +63,7 @@ void BehaviorNodeInstance::setPropertyVariant(const QString &name, const QVarian ObjectNodeInstance::setPropertyVariant(name, value); } -void BehaviorNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void BehaviorNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { if (name == "enabled") return; @@ -71,7 +71,7 @@ void BehaviorNodeInstance::setPropertyBinding(const QString &name, const QString ObjectNodeInstance::setPropertyBinding(name, expression); } -QVariant BehaviorNodeInstance::property(const QString &name) const +QVariant BehaviorNodeInstance::property(const PropertyName &name) const { if (name == "enabled") return QVariant::fromValue(m_isEnabled); @@ -79,7 +79,7 @@ QVariant BehaviorNodeInstance::property(const QString &name) const return ObjectNodeInstance::property(name); } -void BehaviorNodeInstance::resetProperty(const QString &name) +void BehaviorNodeInstance::resetProperty(const PropertyName &name) { if (name == "enabled") m_isEnabled = true; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/behaviornodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/behaviornodeinstance.h index 91dc0cef70..0cc6d68891 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/behaviornodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/behaviornodeinstance.h @@ -45,12 +45,12 @@ public: static Pointer create(QObject *objectToBeWrapped); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyBinding(const PropertyName &name, const QString &expression); - QVariant property(const QString &name) const; - void resetProperty(const QString &name); + QVariant property(const PropertyName &name) const; + void resetProperty(const PropertyName &name); private: bool m_isEnabled; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/graphicsobjectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/graphicsobjectnodeinstance.cpp index 062187e196..ba61b13bb9 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/graphicsobjectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/graphicsobjectnodeinstance.cpp @@ -237,17 +237,17 @@ bool GraphicsObjectNodeInstance::isGraphicsObject() const return true; } -void GraphicsObjectNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void GraphicsObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { ObjectNodeInstance::setPropertyVariant(name, value); } -void GraphicsObjectNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void GraphicsObjectNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { ObjectNodeInstance::setPropertyBinding(name, expression); } -QVariant GraphicsObjectNodeInstance::property(const QString &name) const +QVariant GraphicsObjectNodeInstance::property(const PropertyName &name) const { return ObjectNodeInstance::property(name); } diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/graphicsobjectnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/graphicsobjectnodeinstance.h index 4edf2baafd..8350bc9612 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/graphicsobjectnodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/graphicsobjectnodeinstance.h @@ -65,9 +65,9 @@ public: bool equalGraphicsItem(QGraphicsItem *item) const; - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); - QVariant property(const QString &name) const; + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyBinding(const PropertyName &name, const QString &expression); + QVariant property(const PropertyName &name) const; bool hasContent() const; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancemetaobject.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancemetaobject.cpp index 2c7f1dd6f6..101281d7de 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancemetaobject.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancemetaobject.cpp @@ -46,7 +46,7 @@ NodeInstanceMetaObject::NodeInstanceMetaObject(const ObjectNodeInstance::Pointer setCached(true); } -NodeInstanceMetaObject::NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const QString &prefix, QDeclarativeEngine *engine) +NodeInstanceMetaObject::NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const PropertyName &prefix, QDeclarativeEngine *engine) : QDeclarativeOpenMetaObject(object, new QDeclarativeOpenMetaObjectType(object->metaObject(), engine), true), m_nodeInstance(nodeInstance), m_prefix(prefix) @@ -56,7 +56,7 @@ NodeInstanceMetaObject::NodeInstanceMetaObject(const ObjectNodeInstancePointer & void NodeInstanceMetaObject::createNewProperty(const QString &name) { - int id = createProperty(name.toLatin1(), 0); + int id = createProperty(name.toUtf8(), 0); setValue(id, QVariant()); Q_ASSERT(id >= 0); Q_UNUSED(id) diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancemetaobject.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancemetaobject.h index 502117f0a0..1dbec0bd0e 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancemetaobject.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancemetaobject.h @@ -33,7 +33,10 @@ #include <QDeclarativeContext> #include <private/qdeclarativeopenmetaobject_p.h> +#include "nodeinstanceglobal.h" + namespace QmlDesigner { + namespace Internal { class ObjectNodeInstance; @@ -44,7 +47,7 @@ class NodeInstanceMetaObject : public QDeclarativeOpenMetaObject { public: NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QDeclarativeEngine *engine); - NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const QString &prefix, QDeclarativeEngine *engine); + NodeInstanceMetaObject(const ObjectNodeInstancePointer &nodeInstance, QObject *object, const PropertyName &prefix, QDeclarativeEngine *engine); void createNewProperty(const QString &name); protected: @@ -53,7 +56,7 @@ protected: private: ObjectNodeInstanceWeakPointer m_nodeInstance; - QString m_prefix; + PropertyName m_prefix; QWeakPointer<QDeclarativeContext> m_context; }; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.cpp index fa7167b037..2f74cef389 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.cpp @@ -655,7 +655,7 @@ Internal::ChildrenChangeEventFilter *NodeInstanceServer::childrenChangeEventFilt return m_childrenChangeEventFilter.data(); } -void NodeInstanceServer::addFilePropertyToFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path) +void NodeInstanceServer::addFilePropertyToFileSystemWatcher(QObject *object, const PropertyName &propertyName, const QString &path) { if (!m_fileSystemWatcherHash.contains(path)) { m_fileSystemWatcherHash.insert(path, ObjectPropertyPair(object, propertyName)); @@ -663,7 +663,7 @@ void NodeInstanceServer::addFilePropertyToFileSystemWatcher(QObject *object, con } } -void NodeInstanceServer::removeFilePropertyFromFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path) +void NodeInstanceServer::removeFilePropertyFromFileSystemWatcher(QObject *object, const PropertyName &propertyName, const QString &path) { if (m_fileSystemWatcherHash.contains(path)) { fileSystemWatcher()->removePath(path); @@ -676,7 +676,7 @@ void NodeInstanceServer::refreshLocalFileProperty(const QString &path) if (m_fileSystemWatcherHash.contains(path)) { foreach (const ObjectPropertyPair &objectPropertyPair, m_fileSystemWatcherHash) { QObject *object = objectPropertyPair.first.data(); - QString propertyName = objectPropertyPair.second; + PropertyName propertyName = objectPropertyPair.second; if (hasInstanceForObject(object)) { instanceForObject(object).refreshProperty(propertyName); @@ -728,7 +728,7 @@ void NodeInstanceServer::resetInstanceProperty(const PropertyAbstractContainer & ServerNodeInstance instance = instanceForId(propertyContainer.instanceId()); Q_ASSERT(instance.isValid()); - const QString name = propertyContainer.name(); + const PropertyName name = propertyContainer.name(); if (activeStateInstance().isValid() && !instance.isSubclassOf("QtQuick/PropertyChanges")) { bool statePropertyWasReseted = activeStateInstance().resetStateProperty(instance, name, instance.resetVariant(name)); @@ -749,7 +749,7 @@ void NodeInstanceServer::setInstancePropertyBinding(const PropertyBindingContain if (hasInstanceForId(bindingContainer.instanceId())) { ServerNodeInstance instance = instanceForId(bindingContainer.instanceId()); - const QString name = bindingContainer.name(); + const PropertyName name = bindingContainer.name(); const QString expression = bindingContainer.expression(); @@ -783,7 +783,7 @@ void NodeInstanceServer::setInstancePropertyVariant(const PropertyValueContainer ServerNodeInstance instance = instanceForId(valueContainer.instanceId()); - const QString name = valueContainer.name(); + const PropertyName name = valueContainer.name(); const QVariant value = valueContainer.value(); @@ -810,8 +810,8 @@ void NodeInstanceServer::setInstancePropertyVariant(const PropertyValueContainer void NodeInstanceServer::setInstanceAuxiliaryData(const PropertyValueContainer &auxiliaryContainer) { //instanceId() == 0: the item is root - if (auxiliaryContainer.instanceId() == 0 && (auxiliaryContainer.name() == QLatin1String("width") || - auxiliaryContainer.name() == QLatin1String("height"))) { + if (auxiliaryContainer.instanceId() == 0 && (auxiliaryContainer.name() == "width" || + auxiliaryContainer.name() == "height")) { if (!auxiliaryContainer.value().isNull()) { setInstancePropertyVariant(auxiliaryContainer); @@ -819,8 +819,8 @@ void NodeInstanceServer::setInstanceAuxiliaryData(const PropertyValueContainer & rootNodeInstance().resetProperty(auxiliaryContainer.name()); } } - if (auxiliaryContainer.name().endsWith(QLatin1String("@NodeInstance"))) { - QString propertyName = auxiliaryContainer.name().leftRef(auxiliaryContainer.name().count() - 12).toString(); + if (auxiliaryContainer.name().endsWith("@NodeInstance")) { + PropertyName propertyName = auxiliaryContainer.name().left(auxiliaryContainer.name().count() - 12); if (!auxiliaryContainer.value().isNull()) { setInstancePropertyVariant(PropertyValueContainer(auxiliaryContainer.instanceId(), propertyName, @@ -891,51 +891,51 @@ static QVector<InformationContainer> createInformationVector(const QList<ServerN informationVector.append(InformationContainer(instance.instanceId(), IsAnchoredByChildren, instance.isAnchoredByChildren())); informationVector.append(InformationContainer(instance.instanceId(), IsAnchoredBySibling, instance.isAnchoredBySibling())); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.fill"), instance.hasAnchor("anchors.fill"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.centerIn"), instance.hasAnchor("anchors.centerIn"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.right"), instance.hasAnchor("anchors.right"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.top"), instance.hasAnchor("anchors.top"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.left"), instance.hasAnchor("anchors.left"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.bottom"), instance.hasAnchor("anchors.bottom"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.horizontalCenter"), instance.hasAnchor("anchors.horizontalCenter"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.verticalCenter"), instance.hasAnchor("anchors.verticalCenter"))); - informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, QString("anchors.baseline"), instance.hasAnchor("anchors.baseline"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.fill"), instance.hasAnchor("anchors.fill"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.centerIn"), instance.hasAnchor("anchors.centerIn"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.right"), instance.hasAnchor("anchors.right"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.top"), instance.hasAnchor("anchors.top"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.left"), instance.hasAnchor("anchors.left"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.bottom"), instance.hasAnchor("anchors.bottom"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.horizontalCenter"), instance.hasAnchor("anchors.horizontalCenter"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.verticalCenter"), instance.hasAnchor("anchors.verticalCenter"))); + informationVector.append(InformationContainer(instance.instanceId(), HasAnchor, PropertyName("anchors.baseline"), instance.hasAnchor("anchors.baseline"))); - QPair<QString, ServerNodeInstance> anchorPair = instance.anchor("anchors.fill"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.fill"), anchorPair.first, anchorPair.second.instanceId())); + QPair<PropertyName, ServerNodeInstance> anchorPair = instance.anchor("anchors.fill"); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.fill"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.centerIn"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.centerIn"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.centerIn"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.right"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.right"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.right"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.top"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.top"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.top"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.left"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.left"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.left"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.bottom"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.bottom"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.bottom"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.horizontalCenter"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.horizontalCenter"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.horizontalCenter"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.verticalCenter"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.verticalCenter"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.verticalCenter"), anchorPair.first, anchorPair.second.instanceId())); anchorPair = instance.anchor("anchors.baseline"); - informationVector.append(InformationContainer(instance.instanceId(), Anchor, QString("anchors.baseline"), anchorPair.first, anchorPair.second.instanceId())); + informationVector.append(InformationContainer(instance.instanceId(), Anchor, PropertyName("anchors.baseline"), anchorPair.first, anchorPair.second.instanceId())); - QStringList propertyNames = instance.propertyNames(); + PropertyNameList propertyNames = instance.propertyNames(); if (initial) { - foreach (const QString &propertyName,propertyNames) + foreach (const PropertyName &propertyName, propertyNames) informationVector.append(InformationContainer(instance.instanceId(), InstanceTypeForProperty, propertyName, instance.instanceType(propertyName))); } - foreach (const QString &propertyName,instance.propertyNames()) { + foreach (const PropertyName &propertyName, instance.propertyNames()) { bool hasChanged = false; bool hasBinding = instance.hasBindingForProperty(propertyName, &hasChanged); if (hasChanged) @@ -973,10 +973,10 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QList< QVector<PropertyValueContainer> valueVector; foreach (const ServerNodeInstance &instance, instanceList) { - foreach (const QString &propertyName, instance.propertyNames()) { + foreach (const PropertyName &propertyName, instance.propertyNames()) { QVariant propertyValue = instance.property(propertyName); if (supportedVariantType(propertyValue.type())) - valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, QString())); + valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, TypeName())); } } @@ -999,13 +999,13 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVecto QVector<PropertyValueContainer> valueVector; foreach (const InstancePropertyPair &property, propertyList) { - const QString propertyName = property.second; + const PropertyName propertyName = property.second; const ServerNodeInstance instance = property.first; if ( instance.isValid()) { QVariant propertyValue = instance.property(propertyName); if (supportedVariantType(propertyValue.type())) - valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, QString())); + valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, TypeName())); } } @@ -1033,7 +1033,7 @@ void NodeInstanceServer::sendDebugOutput(DebugOutputCommand::Type type, const QS nodeInstanceClient()->debugOutput(command); } -void NodeInstanceServer::notifyPropertyChange(qint32 instanceid, const QString &propertyName) +void NodeInstanceServer::notifyPropertyChange(qint32 instanceid, const PropertyName &propertyName) { if (hasInstanceForId(instanceid)) addChangedProperty(InstancePropertyPair(instanceForId(instanceid), propertyName)); diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.h index 8701c3eb18..67da5a69f1 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.h @@ -69,9 +69,9 @@ class NodeInstanceServer : public NodeInstanceServerInterface { Q_OBJECT public: - typedef QPair<QWeakPointer<QObject>, QString> ObjectPropertyPair; + typedef QPair<QWeakPointer<QObject>, PropertyName> ObjectPropertyPair; typedef QPair<qint32, QString> IdPropertyPair; - typedef QPair<ServerNodeInstance, QString> InstancePropertyPair; + typedef QPair<ServerNodeInstance, PropertyName> InstancePropertyPair; typedef QPair<QString, QWeakPointer<QObject> > DummyPair; explicit NodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient); @@ -108,8 +108,8 @@ public: QFileSystemWatcher *fileSystemWatcher(); QFileSystemWatcher *dummydataFileSystemWatcher(); Internal::ChildrenChangeEventFilter *childrenChangeEventFilter() const; - void addFilePropertyToFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path); - void removeFilePropertyFromFileSystemWatcher(QObject *object, const QString &propertyName, const QString &path); + void addFilePropertyToFileSystemWatcher(QObject *object, const PropertyName &propertyName, const QString &path); + void removeFilePropertyFromFileSystemWatcher(QObject *object, const PropertyName &propertyName, const QString &path); QUrl fileUrl() const; @@ -119,7 +119,7 @@ public: ServerNodeInstance rootNodeInstance() const; - void notifyPropertyChange(qint32 instanceid, const QString &propertyName); + void notifyPropertyChange(qint32 instanceid, const PropertyName &propertyName); QStringList imports() const; QObject *dummyContextObject() const; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.cpp index d9382c7850..28b1d37b4c 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.cpp @@ -53,7 +53,7 @@ void NodeInstanceSignalSpy::setObjectNodeInstance(const ObjectNodeInstance::Poin } -void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString &prefix) +void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const PropertyName &prefix) { if (m_registeredObjectList.contains(spiedObject)) // prevent cycles return; @@ -70,7 +70,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString & && QDeclarativeMetaType::isQObject(metaProperty.userType())) { QObject *propertyObject = QDeclarativeMetaType::toQObject(metaProperty.read(spiedObject)); if (propertyObject) - registerObject(propertyObject, prefix + metaProperty.name() + QLatin1Char('.')); + registerObject(propertyObject, prefix + metaProperty.name() + '.'); } else if (metaProperty.hasNotifySignal()) { QMetaMethod metaMethod = metaProperty.notifySignal(); bool isConnecting = QMetaObject::connect(spiedObject, metaMethod.methodIndex(), this, methodeOffset, Qt::DirectConnection); @@ -86,7 +86,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString & && QDeclarativeMetaType::isQObject(metaProperty.userType())) { QObject *propertyObject = QDeclarativeMetaType::toQObject(metaProperty.read(spiedObject)); if (propertyObject) - registerObject(propertyObject, prefix + metaProperty.name() + QLatin1Char('/')); + registerObject(propertyObject, prefix + metaProperty.name() + '/'); } // search recursive in objects list @@ -97,7 +97,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString & for (int i = 0; i < list.count(); i++) { QObject *propertyObject = list.at(i); if (propertyObject) - registerObject(propertyObject, prefix + metaProperty.name() + QLatin1Char('/')); + registerObject(propertyObject, prefix + metaProperty.name() + '/'); } } } diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.h index 6f8bdacdf8..8c1bb7c059 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstancesignalspy.h @@ -34,7 +34,10 @@ #include <QHash> #include <QSharedPointer> +#include "nodeinstanceglobal.h" + namespace QmlDesigner { + namespace Internal { class ObjectNodeInstance; @@ -51,11 +54,11 @@ public: virtual int qt_metacall(QMetaObject::Call, int, void **); protected: - void registerObject(QObject *spiedObject, const QString &prefix = QString()); + void registerObject(QObject *spiedObject, const PropertyName &prefix = PropertyName()); private: int methodeOffset; - QHash<int, QString> m_indexPropertyHash; + QHash<int, PropertyName> m_indexPropertyHash; QObjectList m_registeredObjectList; ObjectNodeInstanceWeakPointer m_objectNodeInstance; }; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp index 47eab50199..c32bdda19c 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp @@ -82,7 +82,7 @@ void ObjectNodeInstance::destroy() if (object()) { setId(QString()); if (m_instanceId >= 0) { - reparent(parentInstance(), m_parentProperty, ObjectNodeInstance::Pointer(), QString()); + reparent(parentInstance(), m_parentProperty, ObjectNodeInstance::Pointer(), PropertyName()); } } @@ -246,7 +246,7 @@ double ObjectNodeInstance::opacity() const return 1.0; } -bool ObjectNodeInstance::hasAnchor(const QString &/*name*/) const +bool ObjectNodeInstance::hasAnchor(const PropertyName &/*name*/) const { return false; } @@ -261,9 +261,9 @@ bool ObjectNodeInstance::isAnchoredByChildren() const return false; } -QPair<QString, ServerNodeInstance> ObjectNodeInstance::anchor(const QString &/*name*/) const +QPair<PropertyName, ServerNodeInstance> ObjectNodeInstance::anchor(const PropertyName &/*name*/) const { - return qMakePair(QString(), ServerNodeInstance()); + return qMakePair(PropertyName(), ServerNodeInstance()); } @@ -292,7 +292,7 @@ static bool hasFullImplementedListInterface(const QDeclarativeListReference &lis static void removeObjectFromList(const QDeclarativeProperty &property, QObject *objectToBeRemoved, QDeclarativeEngine * engine) { - QDeclarativeListReference listReference(property.object(), property.name().toLatin1(), engine); + QDeclarativeListReference listReference(property.object(), property.name().toUtf8(), engine); if (!hasFullImplementedListInterface(listReference)) { qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; @@ -315,7 +315,7 @@ static void removeObjectFromList(const QDeclarativeProperty &property, QObject * listReference.append(object); } -void ObjectNodeInstance::removeFromOldProperty(QObject *object, QObject *oldParent, const QString &oldParentProperty) +void ObjectNodeInstance::removeFromOldProperty(QObject *object, QObject *oldParent, const PropertyName &oldParentProperty) { QDeclarativeProperty property(oldParent, oldParentProperty, context()); @@ -334,7 +334,7 @@ void ObjectNodeInstance::removeFromOldProperty(QObject *object, QObject *oldPare object->setParent(0); } -void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, const QString &newParentProperty) +void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, const PropertyName &newParentProperty) { QDeclarativeProperty property(newParent, newParentProperty, context()); @@ -359,7 +359,7 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c Q_ASSERT(objectToVariant(object).isValid()); } -void ObjectNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const QString &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const QString &newParentProperty) +void ObjectNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty) { if (oldParentInstance) { removeFromOldProperty(object(), oldParentInstance->object(), oldParentProperty); @@ -434,7 +434,7 @@ QVariant ObjectNodeInstance::fixResourcePaths(const QVariant &value) return value; } -void ObjectNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { QDeclarativeProperty property(object(), name, context()); @@ -469,7 +469,7 @@ void ObjectNodeInstance::setPropertyVariant(const QString &name, const QVariant } } -void ObjectNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void ObjectNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { QDeclarativeProperty property(object(), name, context()); @@ -512,7 +512,7 @@ void ObjectNodeInstance::deleteObjectsInList(const QDeclarativeProperty &propert list.clear(); } -void ObjectNodeInstance::resetProperty(const QString &name) +void ObjectNodeInstance::resetProperty(const PropertyName &name) { doResetProperty(name); @@ -523,7 +523,7 @@ void ObjectNodeInstance::resetProperty(const QString &name) doResetProperty("font.pixelSize"); } -void ObjectNodeInstance::refreshProperty(const QString &name) +void ObjectNodeInstance::refreshProperty(const PropertyName &name) { QDeclarativeProperty property(object(), name, context()); @@ -543,14 +543,14 @@ void ObjectNodeInstance::refreshProperty(const QString &name) #else QByteArray key = oldValue.toUrl().toEncoded(QUrl::FormattingOption(0x100)); #endif - QString pixmapKey = QString::fromLatin1(key.constData(), key.count()); + QString pixmapKey = QString::fromUtf8(key.constData(), key.count()); QPixmapCache::remove(pixmapKey); } property.write(oldValue); } -bool ObjectNodeInstance::hasBindingForProperty(const QString &name, bool *hasChanged) const +bool ObjectNodeInstance::hasBindingForProperty(const PropertyName &name, bool *hasChanged) const { QDeclarativeProperty property(object(), name, context()); @@ -565,7 +565,7 @@ bool ObjectNodeInstance::hasBindingForProperty(const QString &name, bool *hasCha return QDeclarativePropertyPrivate::binding(property); } -void ObjectNodeInstance::doResetProperty(const QString &propertyName) +void ObjectNodeInstance::doResetProperty(const PropertyName &propertyName) { m_modelAbstractPropertyHash.remove(propertyName); @@ -613,7 +613,7 @@ void ObjectNodeInstance::doResetProperty(const QString &propertyName) } } -QVariant ObjectNodeInstance::property(const QString &name) const +QVariant ObjectNodeInstance::property(const PropertyName &name) const { if (m_modelAbstractPropertyHash.contains(name)) return QVariant::fromValue(m_modelAbstractPropertyHash.value(name)); @@ -640,9 +640,9 @@ QVariant ObjectNodeInstance::property(const QString &name) const return property.read(); } -QStringList allPropertyNames(QObject *object, const QString &baseName = QString(), QObjectList *inspectedObjects = new QObjectList) +PropertyNameList allPropertyNames(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList) { - QStringList propertyNameList; + PropertyNameList propertyNameList; if (inspectedObjects== 0 || inspectedObjects->contains(object)) @@ -659,28 +659,28 @@ QStringList allPropertyNames(QObject *object, const QString &baseName = QString( if (declarativeProperty.name() != "parent") { QObject *childObject = QDeclarativeMetaType::toQObject(declarativeProperty.read()); if (childObject) - propertyNameList.append(allPropertyNames(childObject, baseName + QString::fromUtf8(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(allPropertyNames(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } } else if (QDeclarativeValueTypeFactory::valueType(metaProperty.userType())) { QDeclarativeValueType *valueType = QDeclarativeValueTypeFactory::valueType(metaProperty.userType()); valueType->setValue(metaProperty.read(object)); - propertyNameList.append(allPropertyNames(valueType, baseName + QString::fromUtf8(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(allPropertyNames(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } else { - propertyNameList.append(baseName + QString::fromUtf8(metaProperty.name())); + propertyNameList.append(baseName + metaProperty.name()); } } return propertyNameList; } -QStringList ObjectNodeInstance::propertyNames() const +PropertyNameList ObjectNodeInstance::propertyNames() const { if (isValid()) return allPropertyNames(object()); - return QStringList(); + return PropertyNameList(); } -QString ObjectNodeInstance::instanceType(const QString &name) const +QString ObjectNodeInstance::instanceType(const PropertyName &name) const { QDeclarativeProperty property(object(), name, context()); if (!property.isValid()) @@ -809,9 +809,9 @@ static void disableTiledBackingStore(QObject *object) #endif } -QStringList propertyNameForWritableProperties(QObject *object, const QString &baseName = QString(), QObjectList *inspectedObjects = new QObjectList()) +PropertyNameList propertyNameForWritableProperties(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList()) { - QStringList propertyNameList; + PropertyNameList propertyNameList; if (inspectedObjects == 0 || inspectedObjects->contains(object)) return propertyNameList; @@ -826,14 +826,14 @@ QStringList propertyNameForWritableProperties(QObject *object, const QString &ba if (declarativeProperty.name() != "parent") { QObject *childObject = QDeclarativeMetaType::toQObject(declarativeProperty.read()); if (childObject) - propertyNameList.append(propertyNameForWritableProperties(childObject, baseName + QString::fromUtf8(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(propertyNameForWritableProperties(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } } else if (QDeclarativeValueTypeFactory::valueType(metaProperty.userType())) { QDeclarativeValueType *valueType = QDeclarativeValueTypeFactory::valueType(metaProperty.userType()); valueType->setValue(metaProperty.read(object)); - propertyNameList.append(propertyNameForWritableProperties(valueType, baseName + QString::fromUtf8(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(propertyNameForWritableProperties(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } else if (metaProperty.isReadable() && metaProperty.isWritable()) { - propertyNameList.append(baseName + QString::fromUtf8(metaProperty.name())); + propertyNameList.append(baseName + PropertyName(metaProperty.name())); } } @@ -845,9 +845,9 @@ static void fixResourcePathsForObject(QObject *object) if (qgetenv("QMLDESIGNER_RC_PATHS").isEmpty()) return; - QStringList propertyNameList = propertyNameForWritableProperties(object); + PropertyNameList propertyNameList = propertyNameForWritableProperties(object); - foreach (const QString &propertyName, propertyNameList) { + foreach (const PropertyName &propertyName, propertyNameList) { QDeclarativeProperty property(object, propertyName, QDeclarativeEngine::contextForObject(object)); const QVariant value = property.read(); @@ -1061,9 +1061,9 @@ void ObjectNodeInstance::deactivateState() void ObjectNodeInstance::populateResetHashes() { - QStringList propertyNameList = propertyNameForWritableProperties(object()); + PropertyNameList propertyNameList = propertyNameForWritableProperties(object()); - foreach(const QString &propertyName, propertyNameList) { + foreach (const PropertyName &propertyName, propertyNameList) { QDeclarativeProperty property(object(), propertyName, QDeclarativeEngine::contextForObject(object())); QDeclarativeAbstractBinding::Pointer binding = QDeclarativeAbstractBinding::getPointer(QDeclarativePropertyPrivate::binding(property)); @@ -1075,22 +1075,22 @@ void ObjectNodeInstance::populateResetHashes() } } -QDeclarativeAbstractBinding *ObjectNodeInstance::resetBinding(const QString &propertyName) const +QDeclarativeAbstractBinding *ObjectNodeInstance::resetBinding(const PropertyName &propertyName) const { return m_resetBindingHash.value(propertyName).data(); } -bool ObjectNodeInstance::hasValidResetBinding(const QString &propertyName) const +bool ObjectNodeInstance::hasValidResetBinding(const PropertyName &propertyName) const { return m_resetBindingHash.contains(propertyName) && m_resetBindingHash.value(propertyName).data(); } -QVariant ObjectNodeInstance::resetValue(const QString &propertyName) const +QVariant ObjectNodeInstance::resetValue(const PropertyName &propertyName) const { return m_resetValueHash.value(propertyName); } -void ObjectNodeInstance::setResetValue(const QString &propertyName, const QVariant &value) +void ObjectNodeInstance::setResetValue(const PropertyName &propertyName, const QVariant &value) { m_resetValueHash.insert(propertyName, value); } @@ -1157,7 +1157,7 @@ int ObjectNodeInstance::penWidth() const return 0; } -void ObjectNodeInstance::createDynamicProperty(const QString &name, const QString &/*typeName*/) +void ObjectNodeInstance::createDynamicProperty(const PropertyName &name, const QString &/*typeName*/) { if (m_metaObject == 0) { qWarning() << "ObjectNodeInstance.createDynamicProperty: No Metaobject."; @@ -1167,17 +1167,17 @@ void ObjectNodeInstance::createDynamicProperty(const QString &name, const QStrin m_metaObject->createNewProperty(name); } -bool ObjectNodeInstance::updateStateVariant(const ObjectNodeInstance::Pointer &/*target*/, const QString &/*propertyName*/, const QVariant &/*value*/) +bool ObjectNodeInstance::updateStateVariant(const ObjectNodeInstance::Pointer &/*target*/, const PropertyName &/*propertyName*/, const QVariant &/*value*/) { return false; } -bool ObjectNodeInstance::updateStateBinding(const ObjectNodeInstance::Pointer &/*target*/, const QString &/*propertyName*/, const QString &/*expression*/) +bool ObjectNodeInstance::updateStateBinding(const ObjectNodeInstance::Pointer &/*target*/, const PropertyName &/*propertyName*/, const QString &/*expression*/) { return false; } -bool ObjectNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &/*target*/, const QString &/*propertyName*/, const QVariant &/*resetValue*/) +bool ObjectNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &/*target*/, const PropertyName &/*propertyName*/, const QVariant &/*resetValue*/) { return false; } diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.h index 3e022089fa..64ff48f0e3 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.h @@ -90,7 +90,7 @@ public: Pointer parentInstance() const; - virtual void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const QString &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const QString &newParentProperty); + virtual void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty); virtual void setId(const QString &id); virtual QString id() const; @@ -114,8 +114,8 @@ public: virtual int penWidth() const; - virtual bool hasAnchor(const QString &name) const; - virtual QPair<QString, ServerNodeInstance> anchor(const QString &name) const; + virtual bool hasAnchor(const PropertyName &name) const; + virtual QPair<PropertyName, ServerNodeInstance> anchor(const PropertyName &name) const; virtual bool isAnchoredBySibling() const; virtual bool isAnchoredByChildren() const; @@ -125,17 +125,17 @@ public: virtual QPointF transformOriginPoint() const; virtual double zValue() const; - virtual void setPropertyVariant(const QString &name, const QVariant &value); - virtual void setPropertyBinding(const QString &name, const QString &expression); - virtual QVariant property(const QString &name) const; - virtual void resetProperty(const QString &name); - virtual void refreshProperty(const QString &name); - virtual QString instanceType(const QString &name) const; - QStringList propertyNames() const; + virtual void setPropertyVariant(const PropertyName &name, const QVariant &value); + virtual void setPropertyBinding(const PropertyName &name, const QString &expression); + virtual QVariant property(const PropertyName &name) const; + virtual void resetProperty(const PropertyName &name); + virtual void refreshProperty(const PropertyName &name); + virtual QString instanceType(const PropertyName &name) const; + PropertyNameList propertyNames() const; virtual QList<ServerNodeInstance> childItems() const; - void createDynamicProperty(const QString &name, const QString &typeName); + void createDynamicProperty(const PropertyName &name, const QString &typeName); void setDeleteHeldInstance(bool deleteInstance); bool deleteHeldInstance() const; @@ -146,10 +146,10 @@ public: virtual void deactivateState(); void populateResetHashes(); - bool hasValidResetBinding(const QString &propertyName) const; - QDeclarativeAbstractBinding *resetBinding(const QString &propertyName) const; - QVariant resetValue(const QString &propertyName) const; - void setResetValue(const QString &propertyName, const QVariant &value); + bool hasValidResetBinding(const PropertyName &propertyName) const; + QDeclarativeAbstractBinding *resetBinding(const PropertyName &propertyName) const; + QVariant resetValue(const PropertyName &propertyName) const; + void setResetValue(const PropertyName &propertyName, const QVariant &value); QObject *object() const; @@ -160,14 +160,14 @@ public: void setInPositioner(bool isInPositioner); virtual void refreshPositioner(); - bool hasBindingForProperty(const QString &name, bool *hasChanged = 0) const; + bool hasBindingForProperty(const PropertyName &name, bool *hasChanged = 0) const; QDeclarativeContext *context() const; QDeclarativeEngine *engine() const; - virtual bool updateStateVariant(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &value); - virtual bool updateStateBinding(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QString &expression); - virtual bool resetStateProperty(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &resetValue); + virtual bool updateStateVariant(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &value); + virtual bool updateStateBinding(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QString &expression); + virtual bool resetStateProperty(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &resetValue); bool isValid() const; @@ -182,22 +182,22 @@ public: static QVariant fixResourcePaths(const QVariant &value); protected: - void doResetProperty(const QString &propertyName); - void removeFromOldProperty(QObject *object, QObject *oldParent, const QString &oldParentProperty); - void addToNewProperty(QObject *object, QObject *newParent, const QString &newParentProperty); + void doResetProperty(const PropertyName &propertyName); + void removeFromOldProperty(QObject *object, QObject *oldParent, const PropertyName &oldParentProperty); + void addToNewProperty(QObject *object, QObject *newParent, const PropertyName &newParentProperty); void deleteObjectsInList(const QDeclarativeProperty &metaProperty); QVariant convertSpecialCharacter(const QVariant& value) const; private: - QHash<QString, QVariant> m_resetValueHash; - QHash<QString, QWeakPointer<QDeclarativeAbstractBinding> > m_resetBindingHash; - QHash<QString, ServerNodeInstance> m_modelAbstractPropertyHash; - mutable QHash<QString, bool> m_hasBindingHash; + QHash<PropertyName, QVariant> m_resetValueHash; + QHash<PropertyName, QWeakPointer<QDeclarativeAbstractBinding> > m_resetBindingHash; + QHash<PropertyName, ServerNodeInstance> m_modelAbstractPropertyHash; + mutable QHash<PropertyName, bool> m_hasBindingHash; qint32 m_instanceId; QString m_id; QWeakPointer<NodeInstanceServer> m_nodeInstanceServer; - QString m_parentProperty; + PropertyName m_parentProperty; bool m_deleteHeldInstance; QWeakPointer<QObject> m_object; NodeInstanceMetaObject *m_metaObject; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/positionernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/positionernodeinstance.cpp index daf675b193..4246429155 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/positionernodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/positionernodeinstance.cpp @@ -48,7 +48,7 @@ bool PositionerNodeInstance::isResizable() const return true; } -void PositionerNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void PositionerNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { if (name == "move" || name == "add") return; @@ -56,7 +56,7 @@ void PositionerNodeInstance::setPropertyVariant(const QString &name, const QVari QmlGraphicsItemNodeInstance::setPropertyVariant(name, value); } -void PositionerNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void PositionerNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { if (name == "move" || name == "add") return; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/positionernodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/positionernodeinstance.h index 60060008b1..a789375d24 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/positionernodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/positionernodeinstance.h @@ -47,8 +47,8 @@ public: static Pointer create(QObject *objectToBeWrapped); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyBinding(const PropertyName &name, const QString &expression); bool isPositioner() const; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.cpp index 185ad48445..b0647a72b4 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.cpp @@ -121,7 +121,7 @@ QSizeF QmlGraphicsItemNodeInstance::size() const return QSizeF(width, height); } -void QmlGraphicsItemNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void QmlGraphicsItemNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { if (name == "state") return; // states are only set by us @@ -155,7 +155,7 @@ void QmlGraphicsItemNodeInstance::setPropertyVariant(const QString &name, const parentInstance()->refreshPositioner(); } -void QmlGraphicsItemNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void QmlGraphicsItemNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { if (name == "state") return; // states are only set by us @@ -163,7 +163,7 @@ void QmlGraphicsItemNodeInstance::setPropertyBinding(const QString &name, const GraphicsObjectNodeInstance::setPropertyBinding(name, expression); } -QVariant QmlGraphicsItemNodeInstance::property(const QString &name) const +QVariant QmlGraphicsItemNodeInstance::property(const PropertyName &name) const { return GraphicsObjectNodeInstance::property(name); } @@ -273,7 +273,7 @@ bool QmlGraphicsItemNodeInstance::isVisible() const return qmlGraphicsItem()->isVisible(); } -void QmlGraphicsItemNodeInstance::resetProperty(const QString &name) +void QmlGraphicsItemNodeInstance::resetProperty(const PropertyName &name) { if (name == "height") { m_hasHeight = false; @@ -329,7 +329,7 @@ void QmlGraphicsItemNodeInstance::resetProperty(const QString &name) parentInstance()->refreshPositioner(); } -void QmlGraphicsItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const QString &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const QString &newParentProperty) +void QmlGraphicsItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty) { if (oldParentInstance && oldParentInstance->isPositioner()) { setInPositioner(false); @@ -359,7 +359,7 @@ void QmlGraphicsItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &ol parentInstance()->refreshPositioner(); } -QDeclarativeAnchors::Anchor anchorLineFlagForName(const QString &name) +QDeclarativeAnchors::Anchor anchorLineFlagForName(const PropertyName &name) { if (name == "anchors.top") return QDeclarativeAnchors::TopAnchor; @@ -387,7 +387,7 @@ QDeclarativeAnchors::Anchor anchorLineFlagForName(const QString &name) return QDeclarativeAnchors::LeftAnchor; } -QString propertyNameForAnchorLine(const QDeclarativeAnchorLine::AnchorLine &anchorLine) +PropertyName propertyNameForAnchorLine(const QDeclarativeAnchorLine::AnchorLine &anchorLine) { switch(anchorLine) { case QDeclarativeAnchorLine::Left: return "left"; @@ -398,13 +398,13 @@ QString propertyNameForAnchorLine(const QDeclarativeAnchorLine::AnchorLine &anch case QDeclarativeAnchorLine::VCenter: return "verticalCenter"; case QDeclarativeAnchorLine::Baseline: return "baseline"; case QDeclarativeAnchorLine::Invalid: - default: return QString(); + default: return PropertyName(); } } -static bool isValidAnchorName(const QString &name) +static bool isValidAnchorName(const PropertyName &name) { - static QStringList anchorNameList(QStringList() << "anchors.top" + static PropertyNameList anchorNameList(PropertyNameList() << "anchors.top" << "anchors.left" << "anchors.right" << "anchors.bottom" @@ -417,13 +417,13 @@ static bool isValidAnchorName(const QString &name) return anchorNameList.contains(name); } -QPair<QString, ServerNodeInstance> QmlGraphicsItemNodeInstance::anchor(const QString &name) const +QPair<PropertyName, ServerNodeInstance> QmlGraphicsItemNodeInstance::anchor(const PropertyName &name) const { if (!isValidAnchorName(name) || !hasAnchor(name)) return GraphicsObjectNodeInstance::anchor(name); QObject *targetObject = 0; - QString targetName; + PropertyName targetName; if (name == "anchors.fill") { targetObject = anchors()->fill(); @@ -462,7 +462,7 @@ QList<ServerNodeInstance> QmlGraphicsItemNodeInstance::stateInstances() const return instanceList; } -bool QmlGraphicsItemNodeInstance::hasAnchor(const QString &name) const +bool QmlGraphicsItemNodeInstance::hasAnchor(const PropertyName &name) const { if (!isValidAnchorName(name)) return false; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.h index ffa08a75a6..89be53582d 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.h @@ -53,18 +53,18 @@ public: QSizeF size() const; // void updateAnchors(); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyBinding(const PropertyName &name, const QString &expression); - QVariant property(const QString &name) const; - void resetProperty(const QString &name); + QVariant property(const PropertyName &name) const; + void resetProperty(const PropertyName &name); - void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const QString &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const QString &newParentProperty); + void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty); int penWidth() const; - bool hasAnchor(const QString &name) const; - QPair<QString, ServerNodeInstance> anchor(const QString &name) const; + bool hasAnchor(const PropertyName &name) const; + QPair<PropertyName, ServerNodeInstance> anchor(const PropertyName &name) const; bool isAnchoredBySibling() const; bool isAnchoredByChildren() const; void doComponentComplete(); diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlpropertychangesnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlpropertychangesnodeinstance.cpp index 28227b8e8e..41c11b92c1 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlpropertychangesnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlpropertychangesnodeinstance.cpp @@ -61,14 +61,14 @@ QmlPropertyChangesNodeInstance::Pointer QmlPropertyChangesNodeInstance::create(Q return instance; } -void QmlPropertyChangesNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void QmlPropertyChangesNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { QMetaObject metaObject = QDeclarativePropertyChanges::staticMetaObject; - if (metaObject.indexOfProperty(name.toLatin1()) > 0) { // 'restoreEntryValues', 'explicit' + if (metaObject.indexOfProperty(name) > 0) { // 'restoreEntryValues', 'explicit' ObjectNodeInstance::setPropertyVariant(name, value); } else { - changesObject()->changeValue(name.toLatin1(), value); + changesObject()->changeValue(name, value); QObject *targetObject = changesObject()->object(); if (targetObject && nodeInstanceServer()->activeStateInstance().isWrappingThisObject(changesObject()->state())) { ServerNodeInstance targetInstance = nodeInstanceServer()->instanceForObject(targetObject); @@ -77,29 +77,29 @@ void QmlPropertyChangesNodeInstance::setPropertyVariant(const QString &name, con } } -void QmlPropertyChangesNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void QmlPropertyChangesNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { QMetaObject metaObject = QDeclarativePropertyChanges::staticMetaObject; - if (metaObject.indexOfProperty(name.toLatin1()) > 0) { // 'restoreEntryValues', 'explicit' + if (metaObject.indexOfProperty(name) > 0) { // 'restoreEntryValues', 'explicit' ObjectNodeInstance::setPropertyBinding(name, expression); } else { - changesObject()->changeExpression(name.toLatin1(), expression); + changesObject()->changeExpression(name, expression); } } -QVariant QmlPropertyChangesNodeInstance::property(const QString &name) const +QVariant QmlPropertyChangesNodeInstance::property(const PropertyName &name) const { - return changesObject()->property(name.toLatin1()); + return changesObject()->property(name); } -void QmlPropertyChangesNodeInstance::resetProperty(const QString &name) +void QmlPropertyChangesNodeInstance::resetProperty(const PropertyName &name) { - changesObject()->removeProperty(name.toLatin1()); + changesObject()->removeProperty(name); } -void QmlPropertyChangesNodeInstance::reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty) +void QmlPropertyChangesNodeInstance::reparent(const ServerNodeInstance &oldParentInstance, const PropertyName &oldParentProperty, const ServerNodeInstance &newParentInstance, const PropertyName &newParentProperty) { changesObject()->detachFromState(); diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlpropertychangesnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlpropertychangesnodeinstance.h index 6f1b1c417e..f0229f008f 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlpropertychangesnodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlpropertychangesnodeinstance.h @@ -55,13 +55,13 @@ public: static Pointer create(QObject *objectToBeWrapped); - virtual void setPropertyVariant(const QString &name, const QVariant &value); - virtual void setPropertyBinding(const QString &name, const QString &expression); - virtual QVariant property(const QString &name) const; - virtual void resetProperty(const QString &name); + virtual void setPropertyVariant(const PropertyName &name, const QVariant &value); + virtual void setPropertyBinding(const PropertyName &name, const QString &expression); + virtual QVariant property(const PropertyName &name) const; + virtual void resetProperty(const PropertyName &name); using ObjectNodeInstance::reparent; // keep the virtual reparent(...) method around - void reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty); + void reparent(const ServerNodeInstance &oldParentInstance, const PropertyName &oldParentProperty, const ServerNodeInstance &newParentInstance, const PropertyName &newParentProperty); protected: QmlPropertyChangesNodeInstance(QDeclarativePropertyChanges *object); diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlstatenodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlstatenodeinstance.cpp index d9ffb55590..0848e58232 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlstatenodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlstatenodeinstance.cpp @@ -99,7 +99,7 @@ bool QmlStateNodeInstance::isStateActive() const return stateObject() && stateGroup() && stateGroup()->state() == property("name"); } -void QmlStateNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void QmlStateNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { bool hasParent = parent(); bool isStateOfTheRootModelNode = parentInstance() && parentInstance()->isRootNodeInstance(); @@ -109,7 +109,7 @@ void QmlStateNodeInstance::setPropertyVariant(const QString &name, const QVarian ObjectNodeInstance::setPropertyVariant(name, value); } -void QmlStateNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void QmlStateNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { bool hasParent = parent(); bool isStateOfTheRootModelNode = parentInstance() && parentInstance()->isRootNodeInstance(); @@ -119,19 +119,19 @@ void QmlStateNodeInstance::setPropertyBinding(const QString &name, const QString ObjectNodeInstance::setPropertyBinding(name, expression); } -bool QmlStateNodeInstance::updateStateVariant(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &value) +bool QmlStateNodeInstance::updateStateVariant(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &value) { - return stateObject()->changeValueInRevertList(target->object(), propertyName.toLatin1(), value); + return stateObject()->changeValueInRevertList(target->object(), propertyName, value); } -bool QmlStateNodeInstance::updateStateBinding(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QString &expression) +bool QmlStateNodeInstance::updateStateBinding(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QString &expression) { - return stateObject()->changeValueInRevertList(target->object(), propertyName.toLatin1(), expression); + return stateObject()->changeValueInRevertList(target->object(), propertyName, expression); } -bool QmlStateNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant & /* resetValue */) +bool QmlStateNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant & /* resetValue */) { - return stateObject()->removeEntryFromRevertList(target->object(), propertyName.toLatin1()); + return stateObject()->removeEntryFromRevertList(target->object(), propertyName); } } // namespace Internal diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlstatenodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlstatenodeinstance.h index d37d5b993c..990f245eef 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlstatenodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlstatenodeinstance.h @@ -49,15 +49,15 @@ public: static Pointer create(QObject *objectToBeWrapped); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyBinding(const PropertyName &name, const QString &expression); void activateState(); void deactivateState(); - bool updateStateVariant(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &value); - bool updateStateBinding(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QString &expression); - bool resetStateProperty(const ObjectNodeInstance::Pointer &target, const QString &propertyName, const QVariant &resetValue); + bool updateStateVariant(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &value); + bool updateStateBinding(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QString &expression); + bool resetStateProperty(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &resetValue); protected: diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmltransitionnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmltransitionnodeinstance.cpp index 79e2aa6b9b..26cf4f42d7 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmltransitionnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmltransitionnodeinstance.cpp @@ -59,7 +59,7 @@ bool QmlTransitionNodeInstance::isTransition() const return true; } -void QmlTransitionNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void QmlTransitionNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { if (name == "from" || name == "to") return; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmltransitionnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmltransitionnodeinstance.h index fc14f14321..b7a7e6e27c 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmltransitionnodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmltransitionnodeinstance.h @@ -47,7 +47,7 @@ public: static Pointer create(QObject *objectToBeWrapped); - void setPropertyVariant(const QString &name, const QVariant &value); + void setPropertyVariant(const PropertyName &name, const QVariant &value); bool isTransition() const; diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.cpp index 3120179c0d..33abe33064 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.cpp @@ -226,7 +226,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe return instance; } -void ServerNodeInstance::reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty) +void ServerNodeInstance::reparent(const ServerNodeInstance &oldParentInstance, const PropertyName &oldParentProperty, const ServerNodeInstance &newParentInstance, const PropertyName &newParentProperty) { m_nodeInstance->reparent(oldParentInstance.m_nodeInstance, oldParentProperty, newParentInstance.m_nodeInstance, newParentProperty); } @@ -283,35 +283,35 @@ QRectF ServerNodeInstance::boundingRect() const return boundingRect; } -void ServerNodeInstance::setPropertyVariant(const QString &name, const QVariant &value) +void ServerNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) { m_nodeInstance->setPropertyVariant(name, value); } -void ServerNodeInstance::setPropertyDynamicVariant(const QString &name, const QString &typeName, const QVariant &value) +void ServerNodeInstance::setPropertyDynamicVariant(const PropertyName &name, const TypeName &typeName, const QVariant &value) { m_nodeInstance->createDynamicProperty(name, typeName); m_nodeInstance->setPropertyVariant(name, value); } -void ServerNodeInstance::setPropertyBinding(const QString &name, const QString &expression) +void ServerNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { m_nodeInstance->setPropertyBinding(name, expression); } -void ServerNodeInstance::setPropertyDynamicBinding(const QString &name, const QString &typeName, const QString &expression) +void ServerNodeInstance::setPropertyDynamicBinding(const PropertyName &name, const TypeName &typeName, const QString &expression) { m_nodeInstance->createDynamicProperty(name, typeName); m_nodeInstance->setPropertyBinding(name, expression); } -void ServerNodeInstance::resetProperty(const QString &name) +void ServerNodeInstance::resetProperty(const PropertyName &name) { m_nodeInstance->resetProperty(name); } -void ServerNodeInstance::refreshProperty(const QString &name) +void ServerNodeInstance::refreshProperty(const PropertyName &name) { m_nodeInstance->refreshProperty(name); } @@ -325,17 +325,17 @@ void ServerNodeInstance::setId(const QString &id) \brief Returns the property value of the property of this NodeInstance. \returns QVariant value */ -QVariant ServerNodeInstance::property(const QString &name) const +QVariant ServerNodeInstance::property(const PropertyName &name) const { return m_nodeInstance->property(name); } -QStringList ServerNodeInstance::propertyNames() const +PropertyNameList ServerNodeInstance::propertyNames() const { return m_nodeInstance->propertyNames(); } -bool ServerNodeInstance::hasBindingForProperty(const QString &name, bool *hasChanged) const +bool ServerNodeInstance::hasBindingForProperty(const PropertyName &name, bool *hasChanged) const { return m_nodeInstance->hasBindingForProperty(name, hasChanged); } @@ -344,7 +344,7 @@ bool ServerNodeInstance::hasBindingForProperty(const QString &name, bool *hasCha \brief Returns the property default value of the property of this NodeInstance. \returns QVariant default value which is the reset value to */ -QVariant ServerNodeInstance::defaultValue(const QString &name) const +QVariant ServerNodeInstance::defaultValue(const PropertyName &name) const { return m_nodeInstance->resetValue(name); } @@ -352,7 +352,7 @@ QVariant ServerNodeInstance::defaultValue(const QString &name) const /*! \brief Returns the type of the property of this NodeInstance. */ -QString ServerNodeInstance::instanceType(const QString &name) const +QString ServerNodeInstance::instanceType(const PropertyName &name) const { return m_nodeInstance->instanceType(name); } @@ -384,7 +384,7 @@ bool ServerNodeInstance::isInPositioner() const return m_nodeInstance->isInPositioner(); } -bool ServerNodeInstance::hasAnchor(const QString &name) const +bool ServerNodeInstance::hasAnchor(const PropertyName &name) const { return m_nodeInstance->hasAnchor(name); } @@ -404,7 +404,7 @@ bool ServerNodeInstance::isAnchoredByChildren() const return m_nodeInstance->isAnchoredByChildren(); } -QPair<QString, ServerNodeInstance> ServerNodeInstance::anchor(const QString &name) const +QPair<PropertyName, ServerNodeInstance> ServerNodeInstance::anchor(const PropertyName &name) const { return m_nodeInstance->anchor(name); } @@ -542,22 +542,22 @@ void ServerNodeInstance::deactivateState() m_nodeInstance->deactivateState(); } -bool ServerNodeInstance::updateStateVariant(const ServerNodeInstance &target, const QString &propertyName, const QVariant &value) +bool ServerNodeInstance::updateStateVariant(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &value) { return m_nodeInstance->updateStateVariant(target.internalInstance(), propertyName, value); } -bool ServerNodeInstance::updateStateBinding(const ServerNodeInstance &target, const QString &propertyName, const QString &expression) +bool ServerNodeInstance::updateStateBinding(const ServerNodeInstance &target, const PropertyName &propertyName, const QString &expression) { return m_nodeInstance->updateStateBinding(target.internalInstance(), propertyName, expression); } -QVariant ServerNodeInstance::resetVariant(const QString &propertyName) const +QVariant ServerNodeInstance::resetVariant(const PropertyName &propertyName) const { return m_nodeInstance->resetValue(propertyName); } -bool ServerNodeInstance::resetStateProperty(const ServerNodeInstance &target, const QString &propertyName, const QVariant &resetValue) +bool ServerNodeInstance::resetStateProperty(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &resetValue) { return m_nodeInstance->resetStateProperty(target.internalInstance(), propertyName, resetValue); } diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.h index 20a1880554..9f49fd76ac 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/servernodeinstance.h @@ -114,13 +114,13 @@ public: double zValue() const; double opacity() const; - QVariant property(const QString &name) const; - QVariant defaultValue(const QString &name) const; - QString instanceType(const QString &name) const; - QStringList propertyNames() const; + QVariant property(const PropertyName &name) const; + QVariant defaultValue(const PropertyName &name) const; + QString instanceType(const PropertyName &name) const; + PropertyNameList propertyNames() const; - bool hasBindingForProperty(const QString &name, bool *hasChanged = 0) const; + bool hasBindingForProperty(const PropertyName &name, bool *hasChanged = 0) const; bool isValid() const; void makeInvalid(); @@ -134,12 +134,12 @@ public: bool isWrappingThisObject(QObject *object) const; - QVariant resetVariant(const QString &name) const; + QVariant resetVariant(const PropertyName &name) const; - bool hasAnchor(const QString &name) const; + bool hasAnchor(const PropertyName &name) const; bool isAnchoredBySibling() const; bool isAnchoredByChildren() const; - QPair<QString, ServerNodeInstance> anchor(const QString &name) const; + QPair<PropertyName, ServerNodeInstance> anchor(const PropertyName &name) const; int penWidth() const; @@ -160,27 +160,27 @@ public: private: // functions ServerNodeInstance(const QSharedPointer<Internal::ObjectNodeInstance> &abstractInstance); - void setPropertyVariant(const QString &name, const QVariant &value); - void setPropertyDynamicVariant(const QString &name, const QString &typeName, const QVariant &value); + void setPropertyVariant(const PropertyName &name, const QVariant &value); + void setPropertyDynamicVariant(const PropertyName &name, const TypeName &typeName, const QVariant &value); - void setPropertyBinding(const QString &name, const QString &expression); - void setPropertyDynamicBinding(const QString &name, const QString &typeName, const QString &expression); + void setPropertyBinding(const PropertyName &name, const QString &expression); + void setPropertyDynamicBinding(const PropertyName &name, const TypeName &typeName, const QString &expression); - void resetProperty(const QString &name); - void refreshProperty(const QString &name); + void resetProperty(const PropertyName &name); + void refreshProperty(const PropertyName &name); void activateState(); void deactivateState(); void refreshState(); - bool updateStateVariant(const ServerNodeInstance &target, const QString &propertyName, const QVariant &value); - bool updateStateBinding(const ServerNodeInstance &target, const QString &propertyName, const QString &expression); - bool resetStateProperty(const ServerNodeInstance &target, const QString &propertyName, const QVariant &resetValue); + bool updateStateVariant(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &value); + bool updateStateBinding(const ServerNodeInstance &target, const PropertyName &propertyName, const QString &expression); + bool resetStateProperty(const ServerNodeInstance &target, const PropertyName &propertyName, const QVariant &resetValue); static ServerNodeInstance create(NodeInstanceServer *nodeInstanceServer, const InstanceContainer &instanceContainer, ComponentWrap componentWrap); void setDeleteHeldInstance(bool deleteInstance); - void reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty); + void reparent(const ServerNodeInstance &oldParentInstance, const PropertyName &oldParentProperty, const ServerNodeInstance &newParentInstance, const PropertyName &newParentProperty); void setId(const QString &id); |