diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2019-10-23 16:29:31 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2019-10-24 08:22:11 +0000 |
commit | 946943203566167a2f8d3e785d6250ed8a8a87cd (patch) | |
tree | e823e51c05eba795eb549bca6e612047570ed845 /share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp | |
parent | 0ddd473cc026c2e4d33ac1a65ee8ffdeb9ac85af (diff) | |
download | qt-creator-946943203566167a2f8d3e785d6250ed8a8a87cd.tar.gz |
QmlDesigner: Add Qt5InformationNodeInstanceServer::modifyProperties()
This method allows to modify properties in the data model from
the puppet. For performance reasons, properties should be modified
in bulks. Each bulk will be one step on the undo stack.
Change-Id: I7dbef02781706c8638981512ca0ec45d24c54545
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp index bd293488f1..9103ef5de0 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -1190,6 +1190,31 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVecto return ValuesChangedCommand(valueVector); } +ValuesModifiedCommand NodeInstanceServer::createValuesModifiedCommand( + const QVector<InstancePropertyValueTriple> &propertyList) const +{ + QVector<PropertyValueContainer> valueVector; + + for (const InstancePropertyValueTriple &property : propertyList) { + const PropertyName propertyName = property.propertyName; + const ServerNodeInstance instance = property.instance; + const QVariant propertyValue = property.propertyValue; + + if (instance.isValid()) { + if (QMetaType::isRegistered(propertyValue.userType()) + && supportedVariantType(propertyValue.type())) { + valueVector.append(PropertyValueContainer(instance.instanceId(), + propertyName, + propertyValue, + PropertyName())); + } + } + } + + return ValuesModifiedCommand(valueVector); +} + + QByteArray NodeInstanceServer::importCode() const { return m_importCode; |