forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
INCLUDEPATH += $$PWD/
|
||||
|
||||
HEADERS += $$PWD/nodeinstanceclientinterface.h
|
||||
HEADERS += $$PWD/interfaces/nodeinstanceglobal.h
|
||||
HEADERS += $$PWD/nodeinstanceserverinterface.h
|
||||
HEADERS += $$PWD/commondefines.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
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() + '/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() + '/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
setupContext();
|
||||
}
|
||||
|
||||
virtual void instancePropertyChange(const QList<QPair<ModelNode, QString> > &)
|
||||
virtual void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &)
|
||||
{}
|
||||
|
||||
virtual void instancesCompleted(const QVector<ModelNode> &)
|
||||
|
||||
@@ -52,49 +52,49 @@ static inline bool checkIfNodeIsAView(const ModelNode &node)
|
||||
node.metaInfo().isSubclassOf("QtQuick.PathView", -1, -1));
|
||||
}
|
||||
|
||||
static inline void getProperties(const ModelNode node, QHash<QString, QVariant> &propertyHash)
|
||||
static inline void getProperties(const ModelNode node, QHash<PropertyName, QVariant> &propertyHash)
|
||||
{
|
||||
if (QmlObjectNode(node).isValid()) {
|
||||
foreach (const QString &propertyName, node.propertyNames()) {
|
||||
foreach (const PropertyName &propertyName, node.propertyNames()) {
|
||||
if (node.property(propertyName).isVariantProperty() ||
|
||||
(node.property(propertyName).isBindingProperty() &&
|
||||
!propertyName.contains(QLatin1String("anchors.")))) {
|
||||
!propertyName.contains("anchors."))) {
|
||||
propertyHash.insert(propertyName, QmlObjectNode(node).instanceValue(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
QmlItemNode itemNode(node);
|
||||
if (itemNode.isValid()) {
|
||||
propertyHash.insert(QLatin1String("width"), itemNode.instanceValue(QLatin1String("width")));
|
||||
propertyHash.insert(QLatin1String("height"), itemNode.instanceValue(QLatin1String("height")));
|
||||
propertyHash.remove(QLatin1String("x"));
|
||||
propertyHash.remove(QLatin1String("y"));
|
||||
propertyHash.remove(QLatin1String("rotation"));
|
||||
propertyHash.remove(QLatin1String("opacity"));
|
||||
propertyHash.insert("width", itemNode.instanceValue("width"));
|
||||
propertyHash.insert("height", itemNode.instanceValue("height"));
|
||||
propertyHash.remove("x");
|
||||
propertyHash.remove("y");
|
||||
propertyHash.remove("rotation");
|
||||
propertyHash.remove("opacity");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void applyProperties(ModelNode &node, const QHash<QString, QVariant> &propertyHash)
|
||||
static inline void applyProperties(ModelNode &node, const QHash<PropertyName, QVariant> &propertyHash)
|
||||
{
|
||||
QHash<QString, QVariant> auxiliaryData = node.auxiliaryData();
|
||||
foreach (const QString propertyName, auxiliaryData.keys()) {
|
||||
QHash<PropertyName, QVariant> auxiliaryData = node.auxiliaryData();
|
||||
foreach (const PropertyName propertyName, auxiliaryData.keys()) {
|
||||
node.setAuxiliaryData(propertyName, QVariant());
|
||||
}
|
||||
|
||||
QHashIterator<QString, QVariant> propertyIterator(propertyHash);
|
||||
QHashIterator<PropertyName, QVariant> propertyIterator(propertyHash);
|
||||
while (propertyIterator.hasNext()) {
|
||||
propertyIterator.next();
|
||||
const QString propertyName = propertyIterator.key();
|
||||
if (propertyName == QLatin1String("width") || propertyName == QLatin1String("height")) {
|
||||
const PropertyName propertyName = propertyIterator.key();
|
||||
if (propertyName == "width" || propertyName == "height") {
|
||||
node.setAuxiliaryData(propertyIterator.key(), propertyIterator.value());
|
||||
} else if (node.property(propertyIterator.key()).isDynamic() &&
|
||||
node.property(propertyIterator.key()).dynamicTypeName() == QLatin1String("alias") &&
|
||||
node.property(propertyIterator.key()).dynamicTypeName() == "alias" &&
|
||||
node.property(propertyIterator.key()).isBindingProperty()) {
|
||||
AbstractProperty targetProperty = node.bindingProperty(propertyIterator.key()).resolveToProperty();
|
||||
if (targetProperty.isValid())
|
||||
targetProperty.parentModelNode().setAuxiliaryData(targetProperty.name() + QLatin1String("@NodeInstance"), propertyIterator.value());
|
||||
targetProperty.parentModelNode().setAuxiliaryData(targetProperty.name() + "@NodeInstance", propertyIterator.value());
|
||||
} else {
|
||||
node.setAuxiliaryData(propertyIterator.key() + QLatin1String("@NodeInstance"), propertyIterator.value());
|
||||
node.setAuxiliaryData(propertyIterator.key() + "@NodeInstance", propertyIterator.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ static inline void openFileForComponent(const ModelNode &node)
|
||||
|
||||
//int width = 0;
|
||||
//int height = 0;
|
||||
QHash<QString, QVariant> propertyHash;
|
||||
QHash<PropertyName, QVariant> propertyHash;
|
||||
if (node.metaInfo().isFileComponent()) {
|
||||
//getWidthHeight(node, width, height);
|
||||
getProperties(node, propertyHash);
|
||||
@@ -202,7 +202,7 @@ static inline void openInlineComponent(const ModelNode &node)
|
||||
if (!currentDesignDocument())
|
||||
return;
|
||||
|
||||
QHash<QString, QVariant> propertyHash;
|
||||
QHash<PropertyName, QVariant> propertyHash;
|
||||
|
||||
if (node.nodeSourceType() == ModelNode::NodeWithComponentSource) {
|
||||
//getWidthHeight(node, width, height);
|
||||
|
||||
@@ -77,7 +77,7 @@ inline bool singleSelectionNotRoot(const SelectionContext &selectionState)
|
||||
inline bool selectionHasProperty(const SelectionContext &selectionState, const char *property)
|
||||
{
|
||||
foreach (const ModelNode &modelNode, selectionState.selectedModelNodes())
|
||||
if (modelNode.hasProperty(QLatin1String(property)))
|
||||
if (modelNode.hasProperty(PropertyName(property)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
const QString auxDataString = QLatin1String("anchors_");
|
||||
const PropertyName auxDataString("anchors_");
|
||||
|
||||
static inline bool isItem(const ModelNode &node)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ static inline void getWidthHeight(const ModelNode &node, int &width, int &height
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool modelNodesHaveProperty(const QList<ModelNode> &modelNodeList, const QString &propertyName)
|
||||
static inline bool modelNodesHaveProperty(const QList<ModelNode> &modelNodeList, const PropertyName &propertyName)
|
||||
{
|
||||
foreach (const ModelNode &modelNode, modelNodeList)
|
||||
if (modelNode.hasProperty(propertyName))
|
||||
@@ -304,7 +304,7 @@ void resetZ(const SelectionContext &selectionState)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void backupPropertyAndRemove(ModelNode node, const QString &propertyName)
|
||||
static inline void backupPropertyAndRemove(ModelNode node, const PropertyName &propertyName)
|
||||
{
|
||||
if (node.hasVariantProperty(propertyName)) {
|
||||
node.setAuxiliaryData(auxDataString + propertyName, node.variantProperty(propertyName).value());
|
||||
@@ -318,7 +318,7 @@ static inline void backupPropertyAndRemove(ModelNode node, const QString &proper
|
||||
}
|
||||
|
||||
|
||||
static inline void restoreProperty(ModelNode node, const QString &propertyName)
|
||||
static inline void restoreProperty(ModelNode node, const PropertyName &propertyName)
|
||||
{
|
||||
if (node.hasAuxiliaryData(auxDataString + propertyName))
|
||||
node.variantProperty(propertyName) = node.auxiliaryData(auxDataString + propertyName);
|
||||
@@ -336,10 +336,10 @@ void anchorsFill(const SelectionContext &selectionState)
|
||||
QmlItemNode node = modelNode;
|
||||
if (node.isValid()) {
|
||||
node.anchors().fill();
|
||||
backupPropertyAndRemove(modelNode, QLatin1String("x"));
|
||||
backupPropertyAndRemove(modelNode, QLatin1String("y"));
|
||||
backupPropertyAndRemove(modelNode, QLatin1String("width"));
|
||||
backupPropertyAndRemove(modelNode, QLatin1String("height"));
|
||||
backupPropertyAndRemove(modelNode, "x");
|
||||
backupPropertyAndRemove(modelNode, "y");
|
||||
backupPropertyAndRemove(modelNode, "width");
|
||||
backupPropertyAndRemove(modelNode, "height");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ static inline void reparentTo(const ModelNode &node, const QmlItemNode &parent)
|
||||
if (parent.hasDefaultProperty())
|
||||
parentProperty = parent.nodeAbstractProperty(parent.defaultProperty());
|
||||
else
|
||||
parentProperty = parent.nodeAbstractProperty(QLatin1String("data"));
|
||||
parentProperty = parent.nodeAbstractProperty("data");
|
||||
|
||||
parentProperty.reparentHere(node);
|
||||
}
|
||||
@@ -431,7 +431,7 @@ void layoutRow(const SelectionContext &selectionState)
|
||||
if (!selectionState.view())
|
||||
return;
|
||||
|
||||
NodeMetaInfo rowMetaInfo = selectionState.view()->model()->metaInfo(QLatin1String("QtQuick.Row"));
|
||||
NodeMetaInfo rowMetaInfo = selectionState.view()->model()->metaInfo("QtQuick.Row");
|
||||
|
||||
if (!rowMetaInfo.isValid())
|
||||
return;
|
||||
@@ -448,7 +448,7 @@ void layoutRow(const SelectionContext &selectionState)
|
||||
|
||||
qDebug() << parent.modelNode().majorQtQuickVersion();
|
||||
|
||||
row = selectionState.view()->createModelNode(QLatin1String("QtQuick.Row"), rowMetaInfo.majorVersion(), rowMetaInfo.minorVersion());
|
||||
row = selectionState.view()->createModelNode("QtQuick.Row", rowMetaInfo.majorVersion(), rowMetaInfo.minorVersion());
|
||||
|
||||
reparentTo(row, parent);
|
||||
}
|
||||
@@ -457,16 +457,16 @@ void layoutRow(const SelectionContext &selectionState)
|
||||
RewriterTransaction transaction(selectionState.view());
|
||||
|
||||
QPoint pos = getUpperLeftPosition(modelNodeList);
|
||||
row.variantProperty(QLatin1String("x")) = pos.x();
|
||||
row.variantProperty(QLatin1String("y")) = pos.y();
|
||||
row.variantProperty("x") = pos.x();
|
||||
row.variantProperty("y") = pos.y();
|
||||
|
||||
QList<ModelNode> sortedList = modelNodeList;
|
||||
qSort(sortedList.begin(), sortedList.end(), compareByX);
|
||||
|
||||
foreach (ModelNode modelNode, sortedList) {
|
||||
reparentTo(modelNode, row);
|
||||
modelNode.removeProperty(QLatin1String("x"));
|
||||
modelNode.removeProperty(QLatin1String("y"));
|
||||
modelNode.removeProperty("x");
|
||||
modelNode.removeProperty("y");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -476,7 +476,7 @@ void layoutColumn(const SelectionContext &selectionState)
|
||||
if (!selectionState.view())
|
||||
return;
|
||||
|
||||
NodeMetaInfo columnMetaInfo = selectionState.view()->model()->metaInfo(QLatin1String("QtQuick.Column"));
|
||||
NodeMetaInfo columnMetaInfo = selectionState.view()->model()->metaInfo("QtQuick.Column");
|
||||
|
||||
if (!columnMetaInfo.isValid())
|
||||
return;
|
||||
@@ -491,7 +491,7 @@ void layoutColumn(const SelectionContext &selectionState)
|
||||
if (!parent.isValid())
|
||||
return;
|
||||
|
||||
column = selectionState.view()->createModelNode(QLatin1String("QtQuick.Column"), columnMetaInfo.majorVersion(), columnMetaInfo.minorVersion());
|
||||
column = selectionState.view()->createModelNode("QtQuick.Column", columnMetaInfo.majorVersion(), columnMetaInfo.minorVersion());
|
||||
|
||||
reparentTo(column, parent);
|
||||
}
|
||||
@@ -500,16 +500,16 @@ void layoutColumn(const SelectionContext &selectionState)
|
||||
RewriterTransaction transaction(selectionState.view());
|
||||
|
||||
QPoint pos = getUpperLeftPosition(modelNodeList);
|
||||
column.variantProperty(QLatin1String("x")) = pos.x();
|
||||
column.variantProperty(QLatin1String("y")) = pos.y();
|
||||
column.variantProperty("x") = pos.x();
|
||||
column.variantProperty("y") = pos.y();
|
||||
|
||||
QList<ModelNode> sortedList = modelNodeList;
|
||||
qSort(sortedList.begin(), sortedList.end(), compareByY);
|
||||
|
||||
foreach (ModelNode modelNode, sortedList) {
|
||||
reparentTo(modelNode, column);
|
||||
modelNode.removeProperty(QLatin1String("x"));
|
||||
modelNode.removeProperty(QLatin1String("y"));
|
||||
modelNode.removeProperty("x");
|
||||
modelNode.removeProperty("y");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -519,7 +519,7 @@ void layoutGrid(const SelectionContext &selectionState)
|
||||
if (!selectionState.view())
|
||||
return;
|
||||
|
||||
NodeMetaInfo gridMetaInfo = selectionState.view()->model()->metaInfo(QLatin1String("QtQuick.Grid"));
|
||||
NodeMetaInfo gridMetaInfo = selectionState.view()->model()->metaInfo("QtQuick.Grid");
|
||||
|
||||
if (!gridMetaInfo.isValid())
|
||||
return;
|
||||
@@ -534,8 +534,8 @@ void layoutGrid(const SelectionContext &selectionState)
|
||||
if (!parent.isValid())
|
||||
return;
|
||||
|
||||
grid = selectionState.view()->createModelNode(QLatin1String("QtQuick.Grid"), gridMetaInfo.majorVersion(), gridMetaInfo.minorVersion());
|
||||
grid.variantProperty(QLatin1String("columns")) = int(sqrt(double(modelNodeList.count())));
|
||||
grid = selectionState.view()->createModelNode("QtQuick.Grid", gridMetaInfo.majorVersion(), gridMetaInfo.minorVersion());
|
||||
grid.variantProperty("columns") = int(sqrt(double(modelNodeList.count())));
|
||||
|
||||
reparentTo(grid, parent);
|
||||
}
|
||||
@@ -544,16 +544,16 @@ void layoutGrid(const SelectionContext &selectionState)
|
||||
RewriterTransaction transaction(selectionState.view());
|
||||
|
||||
QPoint pos = getUpperLeftPosition(modelNodeList);
|
||||
grid.variantProperty(QLatin1String("x")) = pos.x();
|
||||
grid.variantProperty(QLatin1String("y")) = pos.y();
|
||||
grid.variantProperty("x") = pos.x();
|
||||
grid.variantProperty("y") = pos.y();
|
||||
|
||||
QList<ModelNode> sortedList = modelNodeList;
|
||||
qSort(sortedList.begin(), sortedList.end(), compareByGrid);
|
||||
|
||||
foreach (ModelNode modelNode, sortedList) {
|
||||
reparentTo(modelNode, grid);
|
||||
modelNode.removeProperty(QLatin1String("x"));
|
||||
modelNode.removeProperty(QLatin1String("y"));
|
||||
modelNode.removeProperty("x");
|
||||
modelNode.removeProperty("y");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -563,7 +563,7 @@ void layoutFlow(const SelectionContext &selectionState)
|
||||
if (!selectionState.view())
|
||||
return;
|
||||
|
||||
NodeMetaInfo flowMetaInfo = selectionState.view()->model()->metaInfo(QLatin1String("QtQuick.Flow"));
|
||||
NodeMetaInfo flowMetaInfo = selectionState.view()->model()->metaInfo("QtQuick.Flow");
|
||||
|
||||
if (!flowMetaInfo.isValid())
|
||||
return;
|
||||
@@ -578,7 +578,7 @@ void layoutFlow(const SelectionContext &selectionState)
|
||||
if (!parent.isValid())
|
||||
return;
|
||||
|
||||
flow = selectionState.view()->createModelNode(QLatin1String("QtQuick.Flow"), flowMetaInfo.majorVersion(), flowMetaInfo.minorVersion());
|
||||
flow = selectionState.view()->createModelNode("QtQuick.Flow", flowMetaInfo.majorVersion(), flowMetaInfo.minorVersion());
|
||||
|
||||
reparentTo(flow, parent);
|
||||
}
|
||||
@@ -587,16 +587,16 @@ void layoutFlow(const SelectionContext &selectionState)
|
||||
RewriterTransaction transaction(selectionState.view());
|
||||
|
||||
QPoint pos = getUpperLeftPosition(modelNodeList);
|
||||
flow.variantProperty(QLatin1String("x")) = pos.x();
|
||||
flow.variantProperty(QLatin1String("y")) = pos.y();
|
||||
flow.variantProperty("x") = pos.x();
|
||||
flow.variantProperty("y") = pos.y();
|
||||
|
||||
QList<ModelNode> sortedList = modelNodeList;
|
||||
qSort(sortedList.begin(), sortedList.end(), compareByGrid);
|
||||
|
||||
foreach (ModelNode modelNode, sortedList) {
|
||||
reparentTo(modelNode, flow);
|
||||
modelNode.removeProperty(QLatin1String("x"));
|
||||
modelNode.removeProperty(QLatin1String("y"));
|
||||
modelNode.removeProperty("x");
|
||||
modelNode.removeProperty("y");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,14 +548,14 @@ QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode)
|
||||
return QmlItemNode();
|
||||
}
|
||||
|
||||
void FormEditorView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList)
|
||||
void FormEditorView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList)
|
||||
{
|
||||
typedef QPair<ModelNode, QString> NodePropertyPair;
|
||||
typedef QPair<ModelNode, PropertyName> NodePropertyPair;
|
||||
foreach (const NodePropertyPair &nodePropertyPair, propertyList) {
|
||||
const QmlItemNode itemNode(nodePropertyPair.first);
|
||||
const QString propertyName = nodePropertyPair.second;
|
||||
const PropertyName propertyName = nodePropertyPair.second;
|
||||
if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) {
|
||||
static QStringList skipList = QStringList() << "x" << "y" << "width" << "height";
|
||||
static PropertyNameList skipList = PropertyNameList() << "x" << "y" << "width" << "height";
|
||||
if (!skipList.contains(propertyName)) {
|
||||
m_scene->synchronizeOtherProperty(itemNode, propertyName);
|
||||
m_currentTool->formEditorItemsChanged(QList<FormEditorItem*>() << m_scene->itemForQmlItemNode(itemNode));
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
|
||||
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
|
||||
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
||||
void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
|
||||
|
||||
void rewriterBeginTransaction();
|
||||
|
||||
@@ -195,7 +195,7 @@ void ComponentView::variantPropertiesChanged(const QList<VariantProperty>& /*pro
|
||||
void ComponentView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
|
||||
void ComponentView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
|
||||
void ComponentView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) {}
|
||||
void ComponentView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &/*propertyList*/) {}
|
||||
void ComponentView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/) {}
|
||||
void ComponentView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/) {}
|
||||
void ComponentView::instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &/*informationChangeHash*/) {}
|
||||
void ComponentView::instancesRenderImageChanged(const QVector<ModelNode> &/*nodeList*/) {}
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
||||
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||
void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &/*informationChangeHash*/);
|
||||
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
|
||||
|
||||
@@ -567,7 +567,7 @@ void DesignDocument::paste()
|
||||
int offset = double(qrand()) / RAND_MAX * 20 - 10;
|
||||
|
||||
foreach (const ModelNode &node, selectedNodes) {
|
||||
QString defaultProperty(targetNode.metaInfo().defaultPropertyName());
|
||||
PropertyName defaultProperty(targetNode.metaInfo().defaultPropertyName());
|
||||
ModelNode pastedNode(view.insertModel(node));
|
||||
pastedNodeList.append(pastedNode);
|
||||
scatterItem(pastedNode, targetNode, offset);
|
||||
@@ -600,7 +600,7 @@ void DesignDocument::paste()
|
||||
|
||||
targetNode = targetNode.parentProperty().parentModelNode();
|
||||
|
||||
QString defaultProperty(targetNode.metaInfo().defaultPropertyName());
|
||||
PropertyName defaultProperty(targetNode.metaInfo().defaultPropertyName());
|
||||
|
||||
scatterItem(pastedNode, targetNode);
|
||||
if (targetNode.nodeListProperty(defaultProperty).isValid())
|
||||
|
||||
@@ -70,7 +70,7 @@ void DesignDocumentView::scriptFunctionsChanged(const ModelNode &/*node*/, const
|
||||
{
|
||||
}
|
||||
|
||||
void DesignDocumentView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &/*propertyList*/)
|
||||
void DesignDocumentView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ void DesignDocumentView::importsChanged(const QList<Import> &/*addedImports*/, c
|
||||
|
||||
static QStringList arrayToStringList(const QByteArray &byteArray)
|
||||
{
|
||||
QString str(QString::fromLatin1(byteArray));
|
||||
QString str(QString::fromUtf8(byteArray));
|
||||
return str.split('\n');
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ static QByteArray stringListToArray(const QStringList &stringList)
|
||||
QString str;
|
||||
foreach (const QString &subString, stringList)
|
||||
str += subString + '\n';
|
||||
return str.toLatin1();
|
||||
return str.toUtf8();
|
||||
}
|
||||
|
||||
void DesignDocumentView::toClipboard() const
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
virtual void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
||||
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
||||
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||
void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
|
||||
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
|
||||
|
||||
@@ -519,7 +519,7 @@ int ItemLibraryModel::getWidth(const ItemLibraryEntry &itemLibraryEntry)
|
||||
{
|
||||
foreach (const ItemLibraryEntry::Property &property, itemLibraryEntry.properties())
|
||||
{
|
||||
if (property.name() == QLatin1String("width"))
|
||||
if (property.name() == "width")
|
||||
return property.value().toInt();
|
||||
}
|
||||
return 64;
|
||||
@@ -529,7 +529,7 @@ int ItemLibraryModel::getHeight(const ItemLibraryEntry &itemLibraryEntry)
|
||||
{
|
||||
foreach (const ItemLibraryEntry::Property &property, itemLibraryEntry.properties())
|
||||
{
|
||||
if (property.name() == QLatin1String("height"))
|
||||
if (property.name() == "height")
|
||||
return property.value().toInt();
|
||||
}
|
||||
return 64;
|
||||
|
||||
@@ -145,7 +145,7 @@ void ItemLibraryView::scriptFunctionsChanged(const ModelNode &, const QStringLis
|
||||
|
||||
}
|
||||
|
||||
void ItemLibraryView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &)
|
||||
void ItemLibraryView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
const QList<ModelNode> &lastSelectedNodeList);
|
||||
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
||||
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||
void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
|
||||
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
|
||||
|
||||
@@ -236,7 +236,7 @@ void ItemLibraryWidget::setSearchFilter(const QString &searchFilter)
|
||||
nameFilterList.append(QString("*%1*").arg(searchFilter));
|
||||
} else {
|
||||
foreach (const QByteArray &extension, QImageReader::supportedImageFormats()) {
|
||||
nameFilterList.append(QString("*%1*.%2").arg(searchFilter, QString::fromLatin1(extension)));
|
||||
nameFilterList.append(QString("*%1*.%2").arg(searchFilter, QString::fromUtf8(extension)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPo
|
||||
QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode();
|
||||
if (parentNode.isValid()) {
|
||||
QPointF localPos = parentNode.instanceSceneTransform().inverted().map(pos);
|
||||
modelNode.variantProperty(QLatin1String("x")) = localPos.toPoint().x();
|
||||
modelNode.variantProperty(QLatin1String("y")) = localPos.toPoint().y();
|
||||
modelNode.variantProperty("x") = localPos.toPoint().x();
|
||||
modelNode.variantProperty("y") = localPos.toPoint().y();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *data,
|
||||
return false;
|
||||
|
||||
QModelIndex parentIndex, parentItemIndex;
|
||||
QString parentPropertyName;
|
||||
PropertyName parentPropertyName;
|
||||
int targetIndex;
|
||||
|
||||
parentIndex = dropIndex.sibling(dropIndex.row(), 0);
|
||||
@@ -154,7 +154,7 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *data,
|
||||
}
|
||||
else {
|
||||
parentItemIndex = parentIndex.parent();
|
||||
parentPropertyName = parentIndex.data(Qt::DisplayRole).toString();
|
||||
parentPropertyName = parentIndex.data(Qt::DisplayRole).toByteArray();
|
||||
}
|
||||
|
||||
// Disallow dropping items between properties, which are listed first.
|
||||
@@ -509,7 +509,7 @@ void NavigatorTreeModel::removeSubTree(const ModelNode &node)
|
||||
void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty parentProperty, const QList<ModelNode> &modelNodes, int targetIndex)
|
||||
{
|
||||
try {
|
||||
QString propertyQmlType = qmlTypeInQtContainer(parentProperty.parentModelNode().metaInfo().propertyTypeName(parentProperty.name()));
|
||||
TypeName propertyQmlType = qmlTypeInQtContainer(parentProperty.parentModelNode().metaInfo().propertyTypeName(parentProperty.name()));
|
||||
|
||||
RewriterTransaction transaction = m_view->beginRewriterTransaction();
|
||||
foreach (const ModelNode &node, modelNodes) {
|
||||
@@ -577,14 +577,14 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty parentPropert
|
||||
QList<ModelNode> NavigatorTreeModel::modelNodeChildren(const ModelNode &parentNode)
|
||||
{
|
||||
QList<ModelNode> children;
|
||||
QStringList properties;
|
||||
PropertyNameList properties;
|
||||
|
||||
if (parentNode.metaInfo().hasDefaultProperty())
|
||||
properties << parentNode.metaInfo().defaultPropertyName();
|
||||
|
||||
properties << visibleProperties(parentNode);
|
||||
|
||||
foreach (const QString &propertyName, properties) {
|
||||
foreach (const PropertyName &propertyName, properties) {
|
||||
AbstractProperty property(parentNode.property(propertyName));
|
||||
if (property.isNodeProperty())
|
||||
children << property.toNodeProperty().modelNode();
|
||||
@@ -595,9 +595,9 @@ QList<ModelNode> NavigatorTreeModel::modelNodeChildren(const ModelNode &parentNo
|
||||
return children;
|
||||
}
|
||||
|
||||
QString NavigatorTreeModel::qmlTypeInQtContainer(const QString &qtContainerType) const
|
||||
TypeName NavigatorTreeModel::qmlTypeInQtContainer(const TypeName &qtContainerType) const
|
||||
{
|
||||
QString typeName(qtContainerType);
|
||||
TypeName typeName(qtContainerType);
|
||||
if (typeName.startsWith("QDeclarativeListProperty<") &&
|
||||
typeName.endsWith('>')) {
|
||||
typeName.remove(0, 25);
|
||||
@@ -610,17 +610,17 @@ QString NavigatorTreeModel::qmlTypeInQtContainer(const QString &qtContainerType)
|
||||
}
|
||||
|
||||
|
||||
QStringList NavigatorTreeModel::visibleProperties(const ModelNode &node) const
|
||||
PropertyNameList NavigatorTreeModel::visibleProperties(const ModelNode &node) const
|
||||
{
|
||||
QStringList propertyList;
|
||||
PropertyNameList propertyList;
|
||||
|
||||
foreach (const QString &propertyName, node.metaInfo().propertyNames()) {
|
||||
foreach (const PropertyName &propertyName, node.metaInfo().propertyNames()) {
|
||||
if (!propertyName.contains('.') && //do not show any dot properties, since they are tricky and unlikely to make sense
|
||||
node.metaInfo().propertyIsWritable(propertyName) && !m_hiddenProperties.contains(propertyName) &&
|
||||
!node.metaInfo().propertyIsEnumType(propertyName) && //Some enums have the same name as Qml types (e. g. Flow)
|
||||
propertyName != node.metaInfo().defaultPropertyName()) { // TODO: ask the node instances
|
||||
|
||||
QString qmlType = qmlTypeInQtContainer(node.metaInfo().propertyTypeName(propertyName));
|
||||
TypeName qmlType = qmlTypeInQtContainer(node.metaInfo().propertyTypeName(propertyName));
|
||||
if (node.model()->metaInfo(qmlType).isValid() &&
|
||||
node.model()->metaInfo(qmlType).isSubclassOf("QtQuick.Item", -1, -1)) {
|
||||
propertyList.append(propertyName);
|
||||
|
||||
@@ -132,8 +132,8 @@ private:
|
||||
|
||||
QList<ModelNode> modelNodeChildren(const ModelNode &parentNode);
|
||||
|
||||
QString qmlTypeInQtContainer(const QString &qtContainerType) const;
|
||||
QStringList visibleProperties(const ModelNode &node) const;
|
||||
TypeName qmlTypeInQtContainer(const TypeName &qtContainerType) const;
|
||||
PropertyNameList visibleProperties(const ModelNode &node) const;
|
||||
|
||||
bool blockItemChangedSignal(bool block);
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPo
|
||||
QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode();
|
||||
if (parentNode.isValid()) {
|
||||
QPointF localPos = parentNode.instanceSceneTransform().inverted().map(pos);
|
||||
modelNode.variantProperty(QLatin1String("x")) = localPos.toPoint().x();
|
||||
modelNode.variantProperty(QLatin1String("y")) = localPos.toPoint().y();
|
||||
modelNode.variantProperty("x") = localPos.toPoint().x();
|
||||
modelNode.variantProperty("y") = localPos.toPoint().y();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ void NavigatorView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStr
|
||||
{
|
||||
}
|
||||
|
||||
void NavigatorView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &/*propertyList*/)
|
||||
void NavigatorView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
const QList<ModelNode> &lastSelectedNodeList);
|
||||
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
||||
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||
void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
|
||||
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
|
||||
|
||||
@@ -175,7 +175,7 @@ QStandardItem *PluginPath::createModelItem()
|
||||
for (PluginDataList::iterator it = m_plugins.begin(); it != end; ++it) {
|
||||
QStandardItem *pluginItem = new QStandardItem(QFileInfo(it->path).fileName());
|
||||
if (instance(*it)) {
|
||||
pluginItem->appendRow(new QStandardItem(QString::fromLatin1(it->instanceGuard->metaObject()->className())));
|
||||
pluginItem->appendRow(new QStandardItem(QString::fromUtf8(it->instanceGuard->metaObject()->className())));
|
||||
pathItem->appendRow(pluginItem);
|
||||
} else {
|
||||
pluginItem->setToolTip(it->errorMessage);
|
||||
|
||||
@@ -438,9 +438,9 @@ public:
|
||||
fileName = (_styleSheetFile.toLocalFile());
|
||||
Utils::FileReader reader;
|
||||
if (reader.fetch(fileName))
|
||||
q->setStyleSheet(QString::fromLatin1(reader.data()));
|
||||
q->setStyleSheet(QString::fromUtf8(reader.data()));
|
||||
else
|
||||
qWarning() << QString::fromLatin1("setStyleSheetFile: %1").arg(reader.errorString());
|
||||
qWarning() << QString::fromUtf8("setStyleSheetFile: %1").arg(reader.errorString());
|
||||
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ private:
|
||||
qWarning() << "setIconFromFile: failed to load" << path;
|
||||
pb->setIcon(pixmap);
|
||||
} else {
|
||||
qWarning() << QString::fromLatin1("setIconFromFile: %1: %2").arg(path, file.errorString());
|
||||
qWarning() << QString::fromUtf8("setIconFromFile: %1: %2").arg(path, file.errorString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -694,7 +694,7 @@ private:
|
||||
qWarning() << "setIconFromFile: failed to load" << path;
|
||||
lb->setPixmap(pixmap);
|
||||
} else {
|
||||
qWarning() << QString::fromLatin1("setIconFromFile: %1: %2").arg(path, file.errorString());
|
||||
qWarning() << QString::fromUtf8("setIconFromFile: %1: %2").arg(path, file.errorString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -765,7 +765,7 @@ private:
|
||||
qWarning() << "setIconFromFile: failed to load" << path;
|
||||
pb->setIcon(pixmap);
|
||||
} else {
|
||||
qWarning() << QString::fromLatin1("setIconFromFile: %1: %2").arg(path, file.errorString());
|
||||
qWarning() << QString::fromUtf8("setIconFromFile: %1: %2").arg(path, file.errorString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1008,7 +1008,7 @@ void WidgetLoader::setQmlData(const QString &data)
|
||||
m_widget->show();
|
||||
} else {
|
||||
m_component = new QDeclarativeComponent(qmlEngine(this), this);
|
||||
m_component->setData (m_qmlData.toLatin1(), m_baseUrl);
|
||||
m_component->setData (m_qmlData.toUtf8(), m_baseUrl);
|
||||
if (m_component) {
|
||||
emit sourceChanged();
|
||||
emit widgetChanged();
|
||||
|
||||
@@ -88,7 +88,7 @@ BehaviorDialog::BehaviorDialog(QWidget *parent) : QDialog(parent), m_ui(new Inte
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
void BehaviorDialog::setup(const ModelNode &node, const QString propertyName)
|
||||
void BehaviorDialog::setup(const ModelNode &node, const PropertyName propertyName)
|
||||
{
|
||||
m_modelNode = node;
|
||||
m_ui->duration->setValue(100);
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
explicit BehaviorWidget(QWidget *parent = 0);
|
||||
|
||||
ModelNode modelNode() const {return m_modelNode; }
|
||||
QString propertyName() const {return m_propertyName; }
|
||||
PropertyName propertyName() const {return m_propertyName; }
|
||||
|
||||
PropertyEditorNodeWrapper* complexNode() const;
|
||||
void setComplexNode(PropertyEditorNodeWrapper* complexNode);
|
||||
@@ -65,7 +65,7 @@ public slots:
|
||||
|
||||
private:
|
||||
ModelNode m_modelNode;
|
||||
QString m_propertyName;
|
||||
PropertyName m_propertyName;
|
||||
PropertyEditorNodeWrapper* m_complexNode;
|
||||
QScopedPointer<BehaviorDialog> m_BehaviorDialog;
|
||||
};
|
||||
@@ -75,7 +75,7 @@ class BehaviorDialog : public QDialog
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BehaviorDialog(QWidget *parent = 0);
|
||||
void setup(const ModelNode &node, const QString propertyName);
|
||||
void setup(const ModelNode &node, const PropertyName propertyName);
|
||||
|
||||
public slots:
|
||||
virtual void accept();
|
||||
@@ -85,7 +85,7 @@ public slots:
|
||||
|
||||
private:
|
||||
ModelNode m_modelNode;
|
||||
QString m_propertyName;
|
||||
PropertyName m_propertyName;
|
||||
QScopedPointer<Internal::Ui::BehaviorDialog> m_ui;
|
||||
};
|
||||
|
||||
|
||||
@@ -82,12 +82,12 @@ void GradientLineQmlAdaptor::setupGradient()
|
||||
if (!modelNode.isValid())
|
||||
return;
|
||||
|
||||
if (modelNode.hasBindingProperty(gradientName()))
|
||||
if (modelNode.hasBindingProperty(gradientName().toUtf8()))
|
||||
return;
|
||||
|
||||
if (modelNode.hasProperty(gradientName())) { //gradient exists
|
||||
if (modelNode.hasProperty(gradientName().toUtf8())) { //gradient exists
|
||||
|
||||
ModelNode gradientNode = modelNode.nodeProperty(gradientName()).modelNode();
|
||||
ModelNode gradientNode = modelNode.nodeProperty(gradientName().toUtf8()).modelNode();
|
||||
QList<ModelNode> stopList = gradientNode.nodeListProperty("stops").toModelNodeList();
|
||||
|
||||
foreach (const ModelNode &stopNode, stopList) {
|
||||
@@ -115,7 +115,7 @@ void GradientLineQmlAdaptor::writeGradient()
|
||||
if (!m_itemNode.isValid())
|
||||
return;
|
||||
|
||||
if (!m_itemNode.modelNode().metaInfo().hasProperty(gradientName()))
|
||||
if (!m_itemNode.modelNode().metaInfo().hasProperty(gradientName().toUtf8()))
|
||||
return;
|
||||
try {
|
||||
ModelNode modelNode = m_itemNode.modelNode();
|
||||
@@ -123,13 +123,13 @@ void GradientLineQmlAdaptor::writeGradient()
|
||||
QString oldId;
|
||||
QVector<QGradientStop> stops = gradient().stops();
|
||||
if (m_itemNode.isInBaseState()) {
|
||||
if (modelNode.hasProperty(gradientName())) {
|
||||
oldId = modelNode.nodeProperty(gradientName()).modelNode().id();
|
||||
modelNode.removeProperty(gradientName());
|
||||
if (modelNode.hasProperty(gradientName().toUtf8())) {
|
||||
oldId = modelNode.nodeProperty(gradientName().toUtf8()).modelNode().id();
|
||||
modelNode.removeProperty(gradientName().toUtf8());
|
||||
}
|
||||
|
||||
ModelNode gradientNode= modelNode.view()->createModelNode("QtQuick.Gradient", modelNode.majorQtQuickVersion(), 0);
|
||||
modelNode.nodeProperty(gradientName()).reparentHere(gradientNode);
|
||||
modelNode.nodeProperty(gradientName().toUtf8()).reparentHere(gradientNode);
|
||||
|
||||
RewriterTransaction transaction = m_itemNode.modelNode().view()->beginRewriterTransaction();
|
||||
|
||||
@@ -143,11 +143,11 @@ void GradientLineQmlAdaptor::writeGradient()
|
||||
gradientNode.nodeListProperty("stops").reparentHere(gradientStopNode);
|
||||
}
|
||||
} else { //state
|
||||
if (!modelNode.hasProperty(gradientName())) {
|
||||
if (!modelNode.hasProperty(gradientName().toUtf8())) {
|
||||
qWarning(" GradientLine::updateGradient: no gradient in state");
|
||||
return;
|
||||
}
|
||||
ModelNode gradientNode = modelNode.nodeProperty(gradientName()).modelNode();
|
||||
ModelNode gradientNode = modelNode.nodeProperty(gradientName().toUtf8()).modelNode();
|
||||
QList<ModelNode> stopList = gradientNode.nodeListProperty("stops").toModelNodeList();
|
||||
for (int i = 0;i < stops.size(); i++) {
|
||||
QmlObjectNode stopObjectNode = stopList.at(i);
|
||||
@@ -166,15 +166,15 @@ void GradientLineQmlAdaptor::deleteGradient()
|
||||
if (!m_itemNode.isValid())
|
||||
return;
|
||||
|
||||
if (!m_itemNode.modelNode().metaInfo().hasProperty(gradientName()))
|
||||
if (!m_itemNode.modelNode().metaInfo().hasProperty(gradientName().toUtf8()))
|
||||
return;
|
||||
|
||||
ModelNode modelNode = m_itemNode.modelNode();
|
||||
|
||||
if (m_itemNode.isInBaseState()) {
|
||||
if (modelNode.hasProperty(gradientName())) {
|
||||
if (modelNode.hasProperty(gradientName().toUtf8())) {
|
||||
RewriterTransaction transaction = m_itemNode.modelNode().view()->beginRewriterTransaction();
|
||||
ModelNode gradientNode = modelNode.nodeProperty(gradientName()).modelNode();
|
||||
ModelNode gradientNode = modelNode.nodeProperty(gradientName().toUtf8()).modelNode();
|
||||
if (QmlObjectNode(gradientNode).isValid())
|
||||
QmlObjectNode(gradientNode).destroy();
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ LayoutWidget::~LayoutWidget()
|
||||
QPixmap pixmap(url.toLocalFile());
|
||||
button->setIcon(pixmap);
|
||||
} else {
|
||||
qWarning() << QString::fromLatin1("setIconFromFile: %1: %2").arg(
|
||||
qWarning() << QString::fromUtf8("setIconFromFile: %1: %2").arg(
|
||||
file.fileName(), file.errorString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,16 +172,16 @@ PropertyEditor::NodeType::~NodeType()
|
||||
{
|
||||
}
|
||||
|
||||
void setupPropertyEditorValue(const QString &name, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor, const QString &type)
|
||||
void setupPropertyEditorValue(const PropertyName &name, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor, const QString &type)
|
||||
{
|
||||
QString propertyName(name);
|
||||
propertyName.replace(QLatin1Char('.'), QLatin1Char('_'));
|
||||
QmlDesigner::PropertyName propertyName(name);
|
||||
propertyName.replace('.', '_');
|
||||
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(propertyMap->value(propertyName)));
|
||||
if (!valueObject) {
|
||||
valueObject = new PropertyEditorValue(propertyMap);
|
||||
QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), propertyMap, SIGNAL(valueChanged(QString,QVariant)));
|
||||
QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString)));
|
||||
propertyMap->insert(propertyName, QVariant::fromValue(valueObject));
|
||||
propertyMap->insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
|
||||
}
|
||||
valueObject->setName(propertyName);
|
||||
if (type == "QColor")
|
||||
@@ -191,16 +191,16 @@ void setupPropertyEditorValue(const QString &name, QDeclarativePropertyMap *prop
|
||||
|
||||
}
|
||||
|
||||
void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor)
|
||||
void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor)
|
||||
{
|
||||
QString propertyName(name);
|
||||
propertyName.replace(QLatin1Char('.'), QLatin1Char('_'));
|
||||
PropertyName propertyName(name);
|
||||
propertyName.replace('.', '_');
|
||||
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(propertyMap->value(propertyName)));
|
||||
if (!valueObject) {
|
||||
valueObject = new PropertyEditorValue(propertyMap);
|
||||
QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), propertyMap, SIGNAL(valueChanged(QString,QVariant)));
|
||||
QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString)));
|
||||
propertyMap->insert(propertyName, QVariant::fromValue(valueObject));
|
||||
propertyMap->insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
|
||||
}
|
||||
valueObject->setName(name);
|
||||
valueObject->setModelNode(fxObjectNode);
|
||||
@@ -211,7 +211,7 @@ void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const QString
|
||||
else
|
||||
valueObject->setValue(value);
|
||||
|
||||
if (propertyName != QLatin1String("id") &&
|
||||
if (propertyName != "id" &&
|
||||
fxObjectNode.currentState().isBaseState() &&
|
||||
fxObjectNode.modelNode().property(propertyName).isBindingProperty()) {
|
||||
valueObject->setExpression(fxObjectNode.modelNode().bindingProperty(propertyName).expression());
|
||||
@@ -220,10 +220,10 @@ void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const QString
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyEditor::NodeType::setValue(const QmlObjectNode & fxObjectNode, const QString &name, const QVariant &value)
|
||||
void PropertyEditor::NodeType::setValue(const QmlObjectNode & fxObjectNode, const PropertyName &name, const QVariant &value)
|
||||
{
|
||||
QString propertyName = name;
|
||||
propertyName.replace(QLatin1Char('.'), QLatin1Char('_'));
|
||||
PropertyName propertyName = name;
|
||||
propertyName.replace('.', '_');
|
||||
PropertyEditorValue *propertyValue = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(propertyName)));
|
||||
if (propertyValue) {
|
||||
propertyValue->setValue(value);
|
||||
@@ -242,7 +242,7 @@ void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QS
|
||||
QDeclarativeContext *ctxt = m_view->rootContext();
|
||||
|
||||
if (fxObjectNode.isValid()) {
|
||||
foreach (const QString &propertyName, fxObjectNode.modelNode().metaInfo().propertyNames())
|
||||
foreach (const PropertyName &propertyName, fxObjectNode.modelNode().metaInfo().propertyNames())
|
||||
createPropertyEditorValue(fxObjectNode, propertyName, fxObjectNode.instanceValue(propertyName), &m_backendValuesPropertyMap, propertyEditor);
|
||||
|
||||
// className
|
||||
@@ -298,13 +298,13 @@ void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QS
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyEditor::NodeType::initialSetup(const QString &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor)
|
||||
void PropertyEditor::NodeType::initialSetup(const TypeName &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor)
|
||||
{
|
||||
QDeclarativeContext *ctxt = m_view->rootContext();
|
||||
|
||||
NodeMetaInfo metaInfo = propertyEditor->model()->metaInfo(typeName, 4, 7);
|
||||
|
||||
foreach (const QString &propertyName, metaInfo.propertyNames())
|
||||
foreach (const PropertyName &propertyName, metaInfo.propertyNames())
|
||||
setupPropertyEditorValue(propertyName, &m_backendValuesPropertyMap, propertyEditor, metaInfo.propertyTypeName(propertyName));
|
||||
|
||||
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("className")));
|
||||
@@ -393,7 +393,7 @@ static inline QString fixTypeNameForPanes(const QString &typeName)
|
||||
return fixedTypeName;
|
||||
}
|
||||
|
||||
void PropertyEditor::setupPane(const QString &typeName)
|
||||
void PropertyEditor::setupPane(const TypeName &typeName)
|
||||
{
|
||||
NodeMetaInfo metaInfo = model()->metaInfo(typeName);
|
||||
|
||||
@@ -423,8 +423,10 @@ void PropertyEditor::setupPane(const QString &typeName)
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyEditor::changeValue(const QString &propertyName)
|
||||
void PropertyEditor::changeValue(const QString &name)
|
||||
{
|
||||
PropertyName propertyName = name.toUtf8();
|
||||
|
||||
if (propertyName.isNull())
|
||||
return;
|
||||
|
||||
@@ -471,8 +473,8 @@ void PropertyEditor::changeValue(const QString &propertyName)
|
||||
}
|
||||
|
||||
//.replace(QLatin1Char('.'), QLatin1Char('_'))
|
||||
QString underscoreName(propertyName);
|
||||
underscoreName.replace(QLatin1Char('.'), QLatin1Char('_'));
|
||||
PropertyName underscoreName(propertyName);
|
||||
underscoreName.replace('.', '_');
|
||||
PropertyEditorValue *value = qobject_cast<PropertyEditorValue*>(variantToQObject(m_currentType->m_backendValuesPropertyMap.value(underscoreName)));
|
||||
|
||||
if (value ==0)
|
||||
@@ -495,8 +497,8 @@ void PropertyEditor::changeValue(const QString &propertyName)
|
||||
}
|
||||
|
||||
if (fxObjectNode.modelNode().metaInfo().isValid() && fxObjectNode.modelNode().metaInfo().hasProperty(propertyName))
|
||||
if (fxObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == QLatin1String("QUrl")
|
||||
|| fxObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == QLatin1String("url")) { //turn absolute local file paths into relative paths
|
||||
if (fxObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "QUrl"
|
||||
|| fxObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "url") { //turn absolute local file paths into relative paths
|
||||
QString filePath = castedValue.toUrl().toString();
|
||||
if (QFileInfo(filePath).exists() && QFileInfo(filePath).isAbsolute()) {
|
||||
QDir fileDir(QFileInfo(model()->fileUrl().toLocalFile()).absolutePath());
|
||||
@@ -527,8 +529,10 @@ void PropertyEditor::changeValue(const QString &propertyName)
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyEditor::changeExpression(const QString &name)
|
||||
void PropertyEditor::changeExpression(const QString &propertyName)
|
||||
{
|
||||
PropertyName name = propertyName.toUtf8();
|
||||
|
||||
if (name.isNull())
|
||||
return;
|
||||
|
||||
@@ -538,20 +542,20 @@ void PropertyEditor::changeExpression(const QString &name)
|
||||
RewriterTransaction transaction = beginRewriterTransaction();
|
||||
|
||||
try {
|
||||
QString underscoreName(name);
|
||||
underscoreName.replace(QLatin1Char('.'), QLatin1Char('_'));
|
||||
PropertyName underscoreName(name);
|
||||
underscoreName.replace('.', '_');
|
||||
|
||||
QmlObjectNode fxObjectNode(m_selectedNode);
|
||||
PropertyEditorValue *value = qobject_cast<PropertyEditorValue*>(variantToQObject(m_currentType->m_backendValuesPropertyMap.value(underscoreName)));
|
||||
|
||||
if (fxObjectNode.modelNode().metaInfo().isValid() && fxObjectNode.modelNode().metaInfo().hasProperty(name)) {
|
||||
if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == QLatin1String("QColor")) {
|
||||
if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == "QColor") {
|
||||
if (QColor(value->expression().remove('"')).isValid()) {
|
||||
fxObjectNode.setVariantProperty(name, QColor(value->expression().remove('"')));
|
||||
transaction.commit(); //committing in the try block
|
||||
return;
|
||||
}
|
||||
} else if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == QLatin1String("bool")) {
|
||||
} else if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == "bool") {
|
||||
if (value->expression().compare("false", Qt::CaseInsensitive) == 0 || value->expression().compare("true", Qt::CaseInsensitive) == 0) {
|
||||
if (value->expression().compare("true", Qt::CaseInsensitive) == 0)
|
||||
fxObjectNode.setVariantProperty(name, true);
|
||||
@@ -560,7 +564,7 @@ void PropertyEditor::changeExpression(const QString &name)
|
||||
transaction.commit(); //committing in the try block
|
||||
return;
|
||||
}
|
||||
} else if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == QLatin1String("int")) {
|
||||
} else if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == "int") {
|
||||
bool ok;
|
||||
int intValue = value->expression().toInt(&ok);
|
||||
if (ok) {
|
||||
@@ -568,7 +572,7 @@ void PropertyEditor::changeExpression(const QString &name)
|
||||
transaction.commit(); //committing in the try block
|
||||
return;
|
||||
}
|
||||
} else if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == QLatin1String("qreal")) {
|
||||
} else if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == "qreal") {
|
||||
bool ok;
|
||||
qreal realValue = value->expression().toFloat(&ok);
|
||||
if (ok) {
|
||||
@@ -617,46 +621,6 @@ void PropertyEditor::setupPanes()
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void PropertyEditor::otherPropertyChanged(const QmlObjectNode &fxObjectNode, const QString &propertyName)
|
||||
{
|
||||
QmlModelView::otherPropertyChanged(fxObjectNode, propertyName);
|
||||
|
||||
if (!m_selectedNode.isValid())
|
||||
return;
|
||||
|
||||
m_locked = true;
|
||||
|
||||
if (fxObjectNode.isValid() && m_currentType && fxObjectNode == m_selectedNode && fxObjectNode.currentState().isValid()) {
|
||||
AbstractProperty property = fxObjectNode.modelNode().property(propertyName);
|
||||
if (fxObjectNode == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == fxObjectNode) {
|
||||
if ( !m_selectedNode.hasProperty(propertyName) || m_selectedNode.property(property.name()).isBindingProperty() )
|
||||
setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).instanceValue(property.name()));
|
||||
else
|
||||
setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).modelValue(property.name()));
|
||||
}
|
||||
}
|
||||
|
||||
m_locked = false;
|
||||
}
|
||||
|
||||
void PropertyEditor::transformChanged(const QmlObjectNode &fxObjectNode, const QString &propertyName)
|
||||
{
|
||||
QmlModelView::transformChanged(fxObjectNode, propertyName);
|
||||
|
||||
if (!m_selectedNode.isValid())
|
||||
return;
|
||||
|
||||
if (fxObjectNode.isValid() && m_currentType && fxObjectNode == m_selectedNode && fxObjectNode.currentState().isValid()) {
|
||||
AbstractProperty property = fxObjectNode.modelNode().property(propertyName);
|
||||
if (fxObjectNode == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == fxObjectNode) {
|
||||
if ( m_selectedNode.property(property.name()).isBindingProperty() || !m_selectedNode.hasProperty(propertyName))
|
||||
setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).instanceValue(property.name()));
|
||||
else
|
||||
setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).modelValue(property.name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyEditor::setQmlDir(const QString &qmlDir)
|
||||
{
|
||||
m_qmlDir = qmlDir;
|
||||
@@ -688,20 +652,19 @@ QString templateGeneration(NodeMetaInfo type, NodeMetaInfo superType, const QmlO
|
||||
|
||||
QString qmlTemplate = imports.join(QLatin1String("\n")) + QLatin1Char('\n');
|
||||
qmlTemplate += QLatin1String("GroupBox {\n");
|
||||
qmlTemplate += QString(QLatin1String("caption: \"%1\"\n")).arg(objectNode.modelNode().simplifiedTypeName());
|
||||
qmlTemplate += QString(QLatin1String("caption: \"%1\"\n")).arg(QString::fromUtf8(objectNode.modelNode().simplifiedTypeName()));
|
||||
qmlTemplate += QLatin1String("layout: VerticalLayout {\n");
|
||||
|
||||
QList<QString> orderedList;
|
||||
orderedList = type.propertyNames();
|
||||
QList<PropertyName> orderedList = type.propertyNames();
|
||||
qSort(orderedList);
|
||||
|
||||
bool emptyTemplate = true;
|
||||
|
||||
foreach (const QString &name, orderedList) {
|
||||
foreach (const PropertyName &name, orderedList) {
|
||||
|
||||
if (name.startsWith(QLatin1String("__")))
|
||||
if (name.startsWith("__"))
|
||||
continue; //private API
|
||||
QString properName = name;
|
||||
PropertyName properName = name;
|
||||
|
||||
properName.replace('.', '_');
|
||||
|
||||
@@ -710,7 +673,7 @@ QString templateGeneration(NodeMetaInfo type, NodeMetaInfo superType, const QmlO
|
||||
if (typeName == QLatin1String("alias") && objectNode.isValid())
|
||||
typeName = objectNode.instanceType(name);
|
||||
|
||||
if (!superType.hasProperty(name) && type.propertyIsWritable(name) && !name.contains(QLatin1String("."))) {
|
||||
if (!superType.hasProperty(name) && type.propertyIsWritable(name) && !name.contains(".")) {
|
||||
foreach (const QmlJS::SimpleReaderNode::Ptr &node, templateConfiguration()->children())
|
||||
if (variantToStringList(node->property(QLatin1String("typeNames"))).contains(typeName)) {
|
||||
const QString fileName = propertyTemplatesPath() + node->property(QLatin1String("sourceFile")).toString();
|
||||
@@ -718,7 +681,7 @@ QString templateGeneration(NodeMetaInfo type, NodeMetaInfo superType, const QmlO
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
QString source = file.readAll();
|
||||
file.close();
|
||||
qmlTemplate += source.arg(name).arg(properName);
|
||||
qmlTemplate += source.arg(QString::fromUtf8(name)).arg(QString::fromUtf8(properName));
|
||||
emptyTemplate = false;
|
||||
} else {
|
||||
qWarning().nospace() << "template definition source file not found:" << fileName;
|
||||
@@ -751,11 +714,11 @@ void PropertyEditor::resetView()
|
||||
if (m_selectedNode.isValid() && model() != m_selectedNode.model())
|
||||
m_selectedNode = ModelNode();
|
||||
|
||||
QString specificsClassName;
|
||||
TypeName specificsClassName;
|
||||
QUrl qmlFile(qmlForNode(m_selectedNode, specificsClassName));
|
||||
QUrl qmlSpecificsFile;
|
||||
|
||||
QString diffClassName;
|
||||
TypeName diffClassName;
|
||||
if (m_selectedNode.isValid()) {
|
||||
diffClassName = m_selectedNode.metaInfo().typeName();
|
||||
QList<NodeMetaInfo> hierarchy;
|
||||
@@ -804,16 +767,16 @@ void PropertyEditor::resetView()
|
||||
type->m_view->setSource(qmlFile);
|
||||
ctxt->setContextProperty("finishedNotify", QVariant(true));
|
||||
} else {
|
||||
QmlObjectNode fxObjectNode;
|
||||
QmlObjectNode qmlObjectNode;
|
||||
if (m_selectedNode.isValid())
|
||||
fxObjectNode = QmlObjectNode(m_selectedNode);
|
||||
qmlObjectNode = QmlObjectNode(m_selectedNode);
|
||||
QDeclarativeContext *ctxt = type->m_view->rootContext();
|
||||
|
||||
ctxt->setContextProperty("finishedNotify", QVariant(false));
|
||||
if (specificQmlData.isEmpty())
|
||||
type->m_contextObject->setSpecificQmlData(specificQmlData);
|
||||
QString currentStateName = currentState().isValid() ? currentState().name() : QLatin1String("invalid state");
|
||||
type->setup(fxObjectNode, currentStateName, qmlSpecificsFile, this);
|
||||
type->setup(qmlObjectNode, currentStateName, qmlSpecificsFile, this);
|
||||
type->m_contextObject->setGlobalBaseUrl(qmlFile);
|
||||
type->m_contextObject->setSpecificQmlData(specificQmlData);
|
||||
}
|
||||
@@ -899,7 +862,7 @@ void PropertyEditor::propertiesRemoved(const QList<AbstractProperty>& propertyLi
|
||||
ModelNode node(property.parentModelNode());
|
||||
if (node == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == node) {
|
||||
setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).instanceValue(property.name()));
|
||||
if (property.name().contains("anchor", Qt::CaseInsensitive))
|
||||
if (property.name().contains("anchor"))
|
||||
m_currentType->m_backendAnchorBinding.invalidate(m_selectedNode);
|
||||
}
|
||||
}
|
||||
@@ -943,7 +906,7 @@ void PropertyEditor::bindingPropertiesChanged(const QList<BindingProperty>& prop
|
||||
ModelNode node(property.parentModelNode());
|
||||
|
||||
if (node == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == node) {
|
||||
if (property.name().contains("anchor", Qt::CaseInsensitive))
|
||||
if (property.name().contains("anchor"))
|
||||
m_currentType->m_backendAnchorBinding.invalidate(m_selectedNode);
|
||||
if ( QmlObjectNode(m_selectedNode).modelNode().property(property.name()).isBindingProperty())
|
||||
setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).instanceValue(property.name()));
|
||||
@@ -1014,7 +977,35 @@ void PropertyEditor::actualStateChanged(const ModelNode &node)
|
||||
delayedResetView();
|
||||
}
|
||||
|
||||
void PropertyEditor::setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value)
|
||||
void PropertyEditor::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList)
|
||||
{
|
||||
if (!m_selectedNode.isValid())
|
||||
return;
|
||||
m_locked = true;
|
||||
|
||||
typedef QPair<ModelNode, PropertyName> ModelNodePropertyPair;
|
||||
foreach (const ModelNodePropertyPair &propertyPair, propertyList) {
|
||||
const ModelNode modelNode = propertyPair.first;
|
||||
const QmlObjectNode qmlObjectNode(modelNode);
|
||||
const PropertyName propertyName = propertyPair.second;
|
||||
|
||||
if (qmlObjectNode.isValid() && m_currentType && modelNode == m_selectedNode && qmlObjectNode.currentState().isValid()) {
|
||||
const AbstractProperty property = modelNode.property(propertyName);
|
||||
if (modelNode == m_selectedNode || qmlObjectNode.propertyChangeForCurrentState() == qmlObjectNode) {
|
||||
if ( !modelNode.hasProperty(propertyName) || modelNode.property(property.name()).isBindingProperty() )
|
||||
setValue(modelNode, property.name(), qmlObjectNode.instanceValue(property.name()));
|
||||
else
|
||||
setValue(modelNode, property.name(), qmlObjectNode.modelValue(property.name()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_locked = false;
|
||||
|
||||
}
|
||||
|
||||
void PropertyEditor::setValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value)
|
||||
{
|
||||
m_locked = true;
|
||||
m_currentType->setValue(fxObjectNode, name, value);
|
||||
@@ -1069,12 +1060,12 @@ QString PropertyEditor::fileFromUrl(const QUrl &url) const
|
||||
return url.toLocalFile();
|
||||
}
|
||||
|
||||
QUrl PropertyEditor::qmlForNode(const ModelNode &modelNode, QString &className) const
|
||||
QUrl PropertyEditor::qmlForNode(const ModelNode &modelNode, TypeName &className) const
|
||||
{
|
||||
if (modelNode.isValid()) {
|
||||
QList<NodeMetaInfo> hierarchy;
|
||||
hierarchy << modelNode.metaInfo();
|
||||
hierarchy << modelNode.metaInfo().superClasses();
|
||||
hierarchy.append(modelNode.metaInfo());
|
||||
hierarchy.append(modelNode.metaInfo().superClasses());
|
||||
|
||||
foreach (const NodeMetaInfo &info, hierarchy) {
|
||||
QUrl fileUrl = fileToUrl(locateQmlFile(info, qmlFileName(info)));
|
||||
|
||||
@@ -66,8 +66,8 @@ class PropertyEditor: public QmlModelView
|
||||
~NodeType();
|
||||
|
||||
void setup(const QmlObjectNode &fxObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
|
||||
void initialSetup(const QString &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
|
||||
void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value);
|
||||
void initialSetup(const TypeName &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
|
||||
void setValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value);
|
||||
|
||||
DeclarativeWidgetView *m_view;
|
||||
Internal::QmlAnchorBindingProxy m_backendAnchorBinding;
|
||||
@@ -109,14 +109,12 @@ public:
|
||||
|
||||
void resetView();
|
||||
void actualStateChanged(const ModelNode &node);
|
||||
void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
void otherPropertyChanged(const QmlObjectNode &, const QString &propertyName);
|
||||
void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
|
||||
|
||||
void setupPane(const QString &typeName);
|
||||
void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value);
|
||||
void setupPane(const TypeName &typeName);
|
||||
void setValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value);
|
||||
|
||||
private slots:
|
||||
void reloadQml();
|
||||
@@ -129,7 +127,7 @@ private: //functions
|
||||
QString qmlFileName(const NodeMetaInfo &nodeInfo) const;
|
||||
QUrl fileToUrl(const QString &filePath) const;
|
||||
QString fileFromUrl(const QUrl &url) const;
|
||||
QUrl qmlForNode(const ModelNode &modelNode, QString &className) const;
|
||||
QUrl qmlForNode(const ModelNode &modelNode, TypeName &className) const;
|
||||
QString locateQmlFile(const NodeMetaInfo &info, const QString &relativePath) const;
|
||||
void select(const ModelNode& node);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ QVariant PropertyEditorValue::value() const
|
||||
{
|
||||
QVariant returnValue = m_value;
|
||||
if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name()))
|
||||
if (modelNode().metaInfo().propertyTypeName(name()) == QLatin1String("QUrl"))
|
||||
if (modelNode().metaInfo().propertyTypeName(name()) == "QUrl")
|
||||
returnValue = returnValue.toUrl().toString();
|
||||
return returnValue;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ static bool cleverColorCompare(QVariant value1, QVariant value2)
|
||||
|
||||
/* "red" is the same color as "#ff0000"
|
||||
To simplify editing we convert all explicit color names in the hash format */
|
||||
static void fixAmbigousColorNames(const QmlDesigner::ModelNode &modelNode, const QString &name, QVariant *value)
|
||||
static void fixAmbigousColorNames(const QmlDesigner::ModelNode &modelNode, const QmlDesigner::PropertyName &name, QVariant *value)
|
||||
{
|
||||
if (modelNode.isValid() && modelNode.metaInfo().isValid()
|
||||
&& (modelNode.metaInfo().propertyTypeName(name) == "QColor"
|
||||
@@ -110,7 +110,7 @@ static void fixAmbigousColorNames(const QmlDesigner::ModelNode &modelNode, const
|
||||
}
|
||||
}
|
||||
|
||||
static void fixUrl(const QmlDesigner::ModelNode &modelNode, const QString &name, QVariant *value)
|
||||
static void fixUrl(const QmlDesigner::ModelNode &modelNode, const QmlDesigner::PropertyName &name, QVariant *value)
|
||||
{
|
||||
if (modelNode.isValid() && modelNode.metaInfo().isValid()
|
||||
&& (modelNode.metaInfo().propertyTypeName(name) == "QUrl"
|
||||
@@ -125,7 +125,7 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value)
|
||||
if (m_value != value || isBound()) {
|
||||
QVariant newValue = value;
|
||||
if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name()))
|
||||
if (modelNode().metaInfo().propertyTypeName(name()) == QLatin1String("QUrl"))
|
||||
if (modelNode().metaInfo().propertyTypeName(name()) == "QUrl")
|
||||
newValue = QUrl(newValue.toString());
|
||||
|
||||
if (cleverDoubleCompare(newValue, m_value))
|
||||
@@ -201,12 +201,12 @@ bool PropertyEditorValue::isInModel() const
|
||||
return modelNode().isValid() && modelNode().hasProperty(name());
|
||||
}
|
||||
|
||||
QString PropertyEditorValue::name() const
|
||||
QmlDesigner::PropertyName PropertyEditorValue::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void PropertyEditorValue::setName(const QString &name)
|
||||
void PropertyEditorValue::setName(const QmlDesigner::PropertyName &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ void PropertyEditorValue::setIsValid(bool valid)
|
||||
bool PropertyEditorValue::isTranslated() const
|
||||
{
|
||||
if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name()))
|
||||
if (modelNode().metaInfo().propertyTypeName(name()) == QLatin1String("QString") || modelNode().metaInfo().propertyTypeName(name()) == QLatin1String("string")) {
|
||||
if (modelNode().metaInfo().propertyTypeName(name()) == "QString" || modelNode().metaInfo().propertyTypeName(name()) == "string") {
|
||||
const QmlDesigner::QmlObjectNode objectNode(modelNode());
|
||||
if (objectNode.isValid() && objectNode.hasBindingProperty(name())) {
|
||||
//qsTr()
|
||||
@@ -296,7 +296,7 @@ QString PropertyEditorNodeWrapper::type()
|
||||
if (!(m_modelNode.isValid()))
|
||||
return QString();
|
||||
|
||||
return m_modelNode.simplifiedTypeName();
|
||||
return QString::fromUtf8(m_modelNode.simplifiedTypeName());
|
||||
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ QmlDesigner::ModelNode PropertyEditorNodeWrapper::parentModelNode() const
|
||||
return m_editorValue->modelNode();
|
||||
}
|
||||
|
||||
QString PropertyEditorNodeWrapper::propertyName() const
|
||||
QmlDesigner::PropertyName PropertyEditorNodeWrapper::propertyName() const
|
||||
{
|
||||
return m_editorValue->name();
|
||||
}
|
||||
@@ -317,8 +317,7 @@ QDeclarativePropertyMap* PropertyEditorNodeWrapper::properties()
|
||||
|
||||
void PropertyEditorNodeWrapper::add(const QString &type)
|
||||
{
|
||||
|
||||
QString propertyType = type;
|
||||
QmlDesigner::TypeName propertyType = type.toUtf8();
|
||||
|
||||
if ((m_editorValue && m_editorValue->modelNode().isValid())) {
|
||||
if (propertyType.isEmpty())
|
||||
@@ -354,8 +353,10 @@ void PropertyEditorNodeWrapper::remove()
|
||||
emit existsChanged();
|
||||
}
|
||||
|
||||
void PropertyEditorNodeWrapper::changeValue(const QString &name)
|
||||
void PropertyEditorNodeWrapper::changeValue(const QString &propertyName)
|
||||
{
|
||||
const QmlDesigner::PropertyName name = propertyName.toUtf8();
|
||||
|
||||
if (name.isNull())
|
||||
return;
|
||||
if (m_modelNode.isValid()) {
|
||||
@@ -381,7 +382,7 @@ void PropertyEditorNodeWrapper::setup()
|
||||
foreach (QObject *object, m_valuesPropertyMap.children())
|
||||
delete object;
|
||||
|
||||
foreach (const QString &propertyName, m_modelNode.metaInfo().propertyNames()) {
|
||||
foreach (const QmlDesigner::PropertyName &propertyName, m_modelNode.metaInfo().propertyNames()) {
|
||||
if (fxObjectNode.isValid()) {
|
||||
PropertyEditorValue *valueObject = new PropertyEditorValue(&m_valuesPropertyMap);
|
||||
valueObject->setName(propertyName);
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#ifndef PROPERTYEDITORVALUE_H
|
||||
#define PROPERTYEDITORVALUE_H
|
||||
|
||||
#include <qmldesignercorelib_global.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QDeclarativePropertyMap>
|
||||
#include <qdeclarative.h>
|
||||
@@ -53,12 +55,12 @@ public:
|
||||
QString type();
|
||||
QDeclarativePropertyMap* properties();
|
||||
QmlDesigner::ModelNode parentModelNode() const;
|
||||
QString propertyName() const;
|
||||
QmlDesigner::PropertyName propertyName() const;
|
||||
|
||||
public slots:
|
||||
void add(const QString &type = QString());
|
||||
void remove();
|
||||
void changeValue(const QString &name);
|
||||
void changeValue(const QString &propertyName);
|
||||
void update();
|
||||
|
||||
signals:
|
||||
@@ -113,8 +115,8 @@ public:
|
||||
|
||||
bool isTranslated() const;
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
QmlDesigner::PropertyName name() const;
|
||||
void setName(const QmlDesigner::PropertyName &name);
|
||||
|
||||
QmlDesigner::ModelNode modelNode() const;
|
||||
void setModelNode(const QmlDesigner::ModelNode &modelNode);
|
||||
@@ -142,7 +144,7 @@ private: //variables
|
||||
QmlDesigner::ModelNode m_modelNode;
|
||||
QVariant m_value;
|
||||
QString m_expression;
|
||||
QString m_name;
|
||||
QmlDesigner::PropertyName m_name;
|
||||
bool m_isInSubState;
|
||||
bool m_isInModel;
|
||||
bool m_isBound;
|
||||
|
||||
@@ -40,9 +40,9 @@ namespace QmlDesigner {
|
||||
class ModelNode;
|
||||
class NodeState;
|
||||
|
||||
const QString auxDataString = QLatin1String("anchors_");
|
||||
const PropertyName auxDataString("anchors_");
|
||||
|
||||
static inline void backupPropertyAndRemove(ModelNode node, const QString &propertyName)
|
||||
static inline void backupPropertyAndRemove(ModelNode node, const PropertyName &propertyName)
|
||||
{
|
||||
if (node.hasVariantProperty(propertyName)) {
|
||||
node.setAuxiliaryData(auxDataString + propertyName, node.variantProperty(propertyName).value());
|
||||
@@ -56,7 +56,7 @@ static inline void backupPropertyAndRemove(ModelNode node, const QString &proper
|
||||
}
|
||||
|
||||
|
||||
static inline void restoreProperty(ModelNode node, const QString &propertyName)
|
||||
static inline void restoreProperty(ModelNode node, const PropertyName &propertyName)
|
||||
{
|
||||
if (node.hasAuxiliaryData(auxDataString + propertyName))
|
||||
node.variantProperty(propertyName) = node.auxiliaryData(auxDataString + propertyName);
|
||||
|
||||
@@ -294,12 +294,6 @@ void StatesEditorView::nodeOrderChanged(const NodeListProperty &listProperty, co
|
||||
resetModel();
|
||||
}
|
||||
|
||||
void StatesEditorView::nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName)
|
||||
{
|
||||
// sets currentState() used in sceneChanged
|
||||
QmlModelView::nodeInstancePropertyChanged(node, propertyName);
|
||||
}
|
||||
|
||||
void StatesEditorView::actualStateChanged(const ModelNode &node)
|
||||
{
|
||||
QmlModelState newQmlModelState(node);
|
||||
@@ -311,21 +305,6 @@ void StatesEditorView::actualStateChanged(const ModelNode &node)
|
||||
QmlModelView::actualStateChanged(node);
|
||||
}
|
||||
|
||||
void StatesEditorView::transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName)
|
||||
{
|
||||
QmlModelView::transformChanged(qmlObjectNode, propertyName);
|
||||
}
|
||||
|
||||
void StatesEditorView::parentChanged(const QmlObjectNode &qmlObjectNode)
|
||||
{
|
||||
QmlModelView::parentChanged(qmlObjectNode);
|
||||
}
|
||||
|
||||
void StatesEditorView::otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName)
|
||||
{
|
||||
QmlModelView::otherPropertyChanged(qmlObjectNode, propertyName);
|
||||
}
|
||||
|
||||
void StatesEditorView::instancesPreviewImageChanged(const QVector<ModelNode> &nodeList)
|
||||
{
|
||||
int minimumIndex = 10000;
|
||||
|
||||
@@ -48,8 +48,6 @@ public:
|
||||
bool validStateName(const QString &name) const;
|
||||
QString currentStateName() const;
|
||||
|
||||
void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
|
||||
|
||||
// AbstractView
|
||||
void modelAttached(Model *model);
|
||||
void modelAboutToBeDetached(Model *model);
|
||||
|
||||
@@ -111,7 +111,7 @@ Exception::Exception(int line,
|
||||
#endif
|
||||
|
||||
if (s_shouldAssert)
|
||||
Q_ASSERT_X(false, function.toLatin1(), QString("%1:%2 - %3").arg(file).arg(line).arg(function).toLatin1());
|
||||
Q_ASSERT_X(false, function.toUtf8(), QString("%1:%2 - %3").arg(file).arg(line).arg(function).toUtf8());
|
||||
}
|
||||
|
||||
Exception::~Exception()
|
||||
|
||||
@@ -40,7 +40,7 @@ using namespace QmlJS::AST;
|
||||
AddObjectVisitor::AddObjectVisitor(QmlDesigner::TextModifier &modifier,
|
||||
quint32 parentLocation,
|
||||
const QString &content,
|
||||
const QStringList &propertyOrder):
|
||||
const PropertyNameList &propertyOrder):
|
||||
QMLRewriter(modifier),
|
||||
m_parentLocation(parentLocation),
|
||||
m_content(content),
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
AddObjectVisitor(QmlDesigner::TextModifier &modifier,
|
||||
quint32 parentLocation,
|
||||
const QString &content,
|
||||
const QStringList &propertyOrder);
|
||||
const PropertyNameList &propertyOrder);
|
||||
|
||||
protected:
|
||||
virtual bool visit(QmlJS::AST::UiObjectBinding *ast);
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
private:
|
||||
quint32 m_parentLocation;
|
||||
QString m_content;
|
||||
QStringList m_propertyOrder;
|
||||
PropertyNameList m_propertyOrder;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -39,10 +39,10 @@ using namespace QmlJS::AST;
|
||||
|
||||
AddPropertyVisitor::AddPropertyVisitor(QmlDesigner::TextModifier &modifier,
|
||||
quint32 parentLocation,
|
||||
const QString &name,
|
||||
const QmlDesigner::PropertyName &name,
|
||||
const QString &value,
|
||||
QmlRefactoring::PropertyType propertyType,
|
||||
const QStringList &propertyOrder):
|
||||
const PropertyNameList &propertyOrder):
|
||||
QMLRewriter(modifier),
|
||||
m_parentLocation(parentLocation),
|
||||
m_name(name),
|
||||
|
||||
@@ -42,10 +42,10 @@ public:
|
||||
public:
|
||||
AddPropertyVisitor(QmlDesigner::TextModifier &modifier,
|
||||
quint32 parentLocation,
|
||||
const QString &name,
|
||||
const QmlDesigner::PropertyName &name,
|
||||
const QString &value,
|
||||
QmlDesigner::QmlRefactoring::PropertyType propertyType,
|
||||
const QStringList &propertyOrder);
|
||||
const PropertyNameList &propertyOrder);
|
||||
|
||||
protected:
|
||||
virtual bool visit(QmlJS::AST::UiObjectDefinition *ast);
|
||||
@@ -56,10 +56,10 @@ private:
|
||||
|
||||
private:
|
||||
quint32 m_parentLocation;
|
||||
QString m_name;
|
||||
PropertyName m_name;
|
||||
QString m_value;
|
||||
QmlRefactoring::PropertyType m_propertyType;
|
||||
QStringList m_propertyOrder;
|
||||
PropertyNameList m_propertyOrder;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -45,10 +45,10 @@ class Inserter: public QMLRewriter
|
||||
public:
|
||||
Inserter(QmlDesigner::TextModifier &modifier,
|
||||
quint32 targetParentObjectLocation,
|
||||
const QString &targetPropertyName,
|
||||
const QmlDesigner::PropertyName &targetPropertyName,
|
||||
bool targetIsArrayBinding,
|
||||
TextModifier::MoveInfo moveInfo,
|
||||
const QStringList &propertyOrder):
|
||||
const PropertyNameList &propertyOrder):
|
||||
QMLRewriter(modifier),
|
||||
targetParentObjectLocation(targetParentObjectLocation),
|
||||
targetPropertyName(targetPropertyName),
|
||||
@@ -151,18 +151,18 @@ private:
|
||||
|
||||
private:
|
||||
quint32 targetParentObjectLocation;
|
||||
QString targetPropertyName;
|
||||
QmlDesigner::PropertyName targetPropertyName;
|
||||
bool targetIsArrayBinding;
|
||||
TextModifier::MoveInfo moveInfo;
|
||||
QStringList propertyOrder;
|
||||
PropertyNameList propertyOrder;
|
||||
};
|
||||
|
||||
MoveObjectVisitor::MoveObjectVisitor(QmlDesigner::TextModifier &modifier,
|
||||
quint32 objectLocation,
|
||||
const QString &targetPropertyName,
|
||||
const QmlDesigner::PropertyName &targetPropertyName,
|
||||
bool targetIsArrayBinding,
|
||||
quint32 targetParentObjectLocation,
|
||||
const QStringList &propertyOrder):
|
||||
const PropertyNameList &propertyOrder):
|
||||
QMLRewriter(modifier),
|
||||
objectLocation(objectLocation),
|
||||
targetPropertyName(targetPropertyName),
|
||||
|
||||
@@ -40,10 +40,10 @@ class MoveObjectVisitor: public QMLRewriter
|
||||
public:
|
||||
MoveObjectVisitor(QmlDesigner::TextModifier &modifier,
|
||||
quint32 objectLocation,
|
||||
const QString &targetPropertyName,
|
||||
const QmlDesigner::PropertyName &targetPropertyName,
|
||||
bool targetIsArrayBinding,
|
||||
quint32 targetParentObjectLocation,
|
||||
const QStringList &propertyOrder);
|
||||
const PropertyNameList &propertyOrder);
|
||||
|
||||
bool operator ()(QmlJS::AST::UiProgram *ast);
|
||||
|
||||
@@ -58,10 +58,10 @@ private:
|
||||
private:
|
||||
QList<QmlJS::AST::Node *> parents;
|
||||
quint32 objectLocation;
|
||||
QString targetPropertyName;
|
||||
PropertyName targetPropertyName;
|
||||
bool targetIsArrayBinding;
|
||||
quint32 targetParentObjectLocation;
|
||||
QStringList propertyOrder;
|
||||
PropertyNameList propertyOrder;
|
||||
|
||||
QmlJS::AST::UiProgram *program;
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ using namespace QmlJS;
|
||||
using namespace QmlDesigner;
|
||||
using namespace QmlDesigner::Internal;
|
||||
|
||||
QmlRefactoring::QmlRefactoring(const Document::Ptr &doc, TextModifier &modifier, const QStringList &propertyOrder):
|
||||
QmlRefactoring::QmlRefactoring(const Document::Ptr &doc, TextModifier &modifier, const PropertyNameList &propertyOrder):
|
||||
qmlDocument(doc),
|
||||
textModifier(&modifier),
|
||||
m_propertyOrder(propertyOrder)
|
||||
@@ -83,7 +83,7 @@ bool QmlRefactoring::removeImport(const Import &import)
|
||||
return visitor.remove(qmlDocument->qmlProgram(), import);
|
||||
}
|
||||
|
||||
bool QmlRefactoring::addToArrayMemberList(int parentLocation, const QString &propertyName, const QString &content)
|
||||
bool QmlRefactoring::addToArrayMemberList(int parentLocation, const PropertyName &propertyName, const QString &content)
|
||||
{
|
||||
if (parentLocation < 0)
|
||||
return false;
|
||||
@@ -102,7 +102,7 @@ bool QmlRefactoring::addToObjectMemberList(int parentLocation, const QString &co
|
||||
return visit(qmlDocument->qmlProgram());
|
||||
}
|
||||
|
||||
bool QmlRefactoring::addProperty(int parentLocation, const QString &name, const QString &value, PropertyType propertyType)
|
||||
bool QmlRefactoring::addProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType)
|
||||
{
|
||||
if (parentLocation < 0)
|
||||
return false;
|
||||
@@ -111,7 +111,7 @@ bool QmlRefactoring::addProperty(int parentLocation, const QString &name, const
|
||||
return visit(qmlDocument->qmlProgram());
|
||||
}
|
||||
|
||||
bool QmlRefactoring::changeProperty(int parentLocation, const QString &name, const QString &value, PropertyType propertyType)
|
||||
bool QmlRefactoring::changeProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType)
|
||||
{
|
||||
if (parentLocation < 0)
|
||||
return false;
|
||||
@@ -129,7 +129,7 @@ bool QmlRefactoring::changeObjectType(int nodeLocation, const QString &newType)
|
||||
return visit(qmlDocument->qmlProgram());
|
||||
}
|
||||
|
||||
bool QmlRefactoring::moveObject(int objectLocation, const QString &targetPropertyName, bool targetIsArrayBinding, int targetParentObjectLocation)
|
||||
bool QmlRefactoring::moveObject(int objectLocation, const PropertyName &targetPropertyName, bool targetIsArrayBinding, int targetParentObjectLocation)
|
||||
{
|
||||
if (objectLocation < 0 || targetParentObjectLocation < 0)
|
||||
return false;
|
||||
@@ -162,7 +162,7 @@ bool QmlRefactoring::removeObject(int nodeLocation)
|
||||
return visit(qmlDocument->qmlProgram());
|
||||
}
|
||||
|
||||
bool QmlRefactoring::removeProperty(int parentLocation, const QString &name)
|
||||
bool QmlRefactoring::removeProperty(int parentLocation, const PropertyName &name)
|
||||
{
|
||||
if (parentLocation < 0 || name.isEmpty())
|
||||
return false;
|
||||
|
||||
@@ -51,29 +51,29 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
QmlRefactoring(const QmlJS::Document::Ptr &doc, QmlDesigner::TextModifier &modifier, const QStringList &propertyOrder);
|
||||
QmlRefactoring(const QmlJS::Document::Ptr &doc, QmlDesigner::TextModifier &modifier, const PropertyNameList &propertyOrder);
|
||||
|
||||
bool reparseDocument();
|
||||
|
||||
bool addImport(const Import &import);
|
||||
bool removeImport(const Import &import);
|
||||
|
||||
bool addToArrayMemberList(int parentLocation, const QString &propertyName, const QString &content);
|
||||
bool addToArrayMemberList(int parentLocation, const PropertyName &propertyName, const QString &content);
|
||||
bool addToObjectMemberList(int parentLocation, const QString &content);
|
||||
bool addProperty(int parentLocation, const QString &name, const QString &value, PropertyType propertyType);
|
||||
bool changeProperty(int parentLocation, const QString &name, const QString &value, PropertyType propertyType);
|
||||
bool addProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType);
|
||||
bool changeProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType);
|
||||
bool changeObjectType(int nodeLocation, const QString &newType);
|
||||
|
||||
bool moveObject(int objectLocation, const QString &targetPropertyName, bool targetIsArray, int targetParentObjectLocation);
|
||||
bool moveObject(int objectLocation, const PropertyName &targetPropertyName, bool targetIsArray, int targetParentObjectLocation);
|
||||
bool moveObjectBeforeObject(int movingObjectLocation, int beforeObjectLocation, bool inDefaultProperty);
|
||||
|
||||
bool removeObject(int nodeLocation);
|
||||
bool removeProperty(int parentLocation, const QString &name);
|
||||
bool removeProperty(int parentLocation, const PropertyName &name);
|
||||
|
||||
private:
|
||||
QmlJS::Document::Ptr qmlDocument;
|
||||
TextModifier *textModifier;
|
||||
QStringList m_propertyOrder;
|
||||
PropertyNameList m_propertyOrder;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -262,9 +262,9 @@ void QMLRewriter::includeLeadingEmptyLine(int &start) const
|
||||
}
|
||||
|
||||
// FIXME: duplicate code in the QmlJS::Rewriter class, remove this
|
||||
UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QStringList &propertyOrder)
|
||||
UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QmlDesigner::PropertyNameList &propertyOrder)
|
||||
{
|
||||
const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString());
|
||||
const int objectDefinitionInsertionPoint = propertyOrder.indexOf(PropertyName()); // XXX ????
|
||||
|
||||
UiObjectMemberList *lastObjectDef = 0;
|
||||
UiObjectMemberList *lastNonObjectDef = 0;
|
||||
@@ -276,13 +276,13 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m
|
||||
if (cast<UiObjectDefinition*>(member))
|
||||
lastObjectDef = iter;
|
||||
else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(member))
|
||||
idx = propertyOrder.indexOf(toString(arrayBinding->qualifiedId));
|
||||
idx = propertyOrder.indexOf(toString(arrayBinding->qualifiedId).toUtf8());
|
||||
else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(member))
|
||||
idx = propertyOrder.indexOf(toString(objectBinding->qualifiedId));
|
||||
idx = propertyOrder.indexOf(toString(objectBinding->qualifiedId).toUtf8());
|
||||
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(member))
|
||||
idx = propertyOrder.indexOf(toString(scriptBinding->qualifiedId));
|
||||
idx = propertyOrder.indexOf(toString(scriptBinding->qualifiedId).toUtf8());
|
||||
else if (cast<UiPublicMember*>(member))
|
||||
idx = propertyOrder.indexOf(QLatin1String("property"));
|
||||
idx = propertyOrder.indexOf("property");
|
||||
|
||||
if (idx < objectDefinitionInsertionPoint)
|
||||
lastNonObjectDef = iter;
|
||||
@@ -295,7 +295,7 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m
|
||||
}
|
||||
|
||||
// FIXME: duplicate code in the QmlJS::Rewriter class, remove this
|
||||
UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QString &propertyName, const QStringList &propertyOrder)
|
||||
UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QmlDesigner::PropertyName &propertyName, const QmlDesigner::PropertyNameList &propertyOrder)
|
||||
{
|
||||
if (!members)
|
||||
return 0; // empty members
|
||||
@@ -319,7 +319,7 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m
|
||||
|
||||
int idx = propertyOrder.indexOf(propertyName);
|
||||
if (idx == -1)
|
||||
idx = propertyOrder.indexOf(QString());
|
||||
idx = propertyOrder.indexOf(PropertyName());
|
||||
if (idx == -1)
|
||||
idx = propertyOrder.size() - 1;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user