QmlDesigner: Add and dispatch ValuesModifiedCommand

We already have valuesChanged() which notifies that a
property of the C++ QObject has changed.

This patch adds valuesModified() which notifies that values
in the data model should be changed.

While valuesChanged() only changes the so called instance value,
valuesModified() does change the internal data model and as
a result the QML code.
This is done in NodeInstanceView::valuesModified().

This enabled the qml2puppet to acutally change values,
like a property editor would.

Change-Id: I2493b9e626c4b194e332a7a096de3dbf2195514a
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Thomas Hartmann
2019-10-18 16:55:08 +02:00
parent b4bc204a7d
commit 49379bfda7
9 changed files with 58 additions and 6 deletions

View File

@@ -130,6 +130,7 @@ bool compareCommands(const QVariant &command, const QVariant &controlCommand)
{
static const int informationChangedCommandType = QMetaType::type("InformationChangedCommand");
static const int valuesChangedCommandType = QMetaType::type("ValuesChangedCommand");
static const int valuesModifiedCommandType = QMetaType::type("ValuesModifiedCommand");
static const int pixmapChangedCommandType = QMetaType::type("PixmapChangedCommand");
static const int childrenChangedCommandType = QMetaType::type("ChildrenChangedCommand");
static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand");
@@ -144,7 +145,9 @@ bool compareCommands(const QVariant &command, const QVariant &controlCommand)
return command.value<InformationChangedCommand>() == controlCommand.value<InformationChangedCommand>();
else if (command.userType() == valuesChangedCommandType)
return command.value<ValuesChangedCommand>() == controlCommand.value<ValuesChangedCommand>();
else if (command.userType() == pixmapChangedCommandType)
else if (command.userType() == valuesModifiedCommandType)
return command.value<ValuesModifiedCommand>() == controlCommand.value<ValuesModifiedCommand>();
else if (command.userType() == pixmapChangedCommandType)
return command.value<PixmapChangedCommand>() == controlCommand.value<PixmapChangedCommand>();
else if (command.userType() == childrenChangedCommandType)
return command.value<ChildrenChangedCommand>() == controlCommand.value<ChildrenChangedCommand>();
@@ -202,6 +205,11 @@ void NodeInstanceClientProxy::valuesChanged(const ValuesChangedCommand &command)
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::valuesModified(const ValuesModifiedCommand &command)
{
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::pixmapChanged(const PixmapChangedCommand &command)
{
writeCommand(QVariant::fromValue(command));