QmlDesigner: Fix changing dynamic properties on root material object

Changing dynamic properties on a CustomMaterial root object didn't
trigger rendering. Also there were duplicate of the property generated
when it was changed, which made quick3d side ignore the property change.

Fixes: QDS-12469
Change-Id: Ia83eaa76fd4f43428a01baea9a3491a8917aa30d
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-04-19 12:57:58 +03:00
parent f84070f634
commit 2cd9efee63
3 changed files with 25 additions and 2 deletions

View File

@@ -146,7 +146,9 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
&& !changedPropertyList().isEmpty()
&& nodeInstanceClient()->bytesToWrite() < 10000) {
Internal::QuickItemNodeInstance::updateDirtyNode(rootNodeInstance().contentItem());
QQuickItem *rootItem = rootNodeInstance().contentItem();
QQuickDesignerSupport::addDirty(rootItem, QQuickDesignerSupport::Content);
QQuickDesignerSupport::updateDirtyNode(rootItem);
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand({rootNodeInstance()}));
}
@@ -239,6 +241,24 @@ void Qt5RenderNodeInstanceServer::changePropertyValues(const ChangeValuesCommand
if (instance.hasParent() && instance.propertyNames().contains("_isEffectItem"))
makeDirtyRecursive(instance.parent());
} else if (container.isDynamic() && hasInstanceForId(container.instanceId())) {
// Changes to dynamic properties are not always noticed by normal signal spy mechanism
addChangedProperty(InstancePropertyPair(instanceForId(container.instanceId()),
container.name()));
}
}
}
void Qt5RenderNodeInstanceServer::changePropertyBindings(const ChangeBindingsCommand &command)
{
Qt5NodeInstanceServer::changePropertyBindings(command);
const QVector<PropertyBindingContainer> changes = command.bindingChanges;
for (const PropertyBindingContainer &container : changes) {
if (container.isDynamic() && hasInstanceForId(container.instanceId())) {
// Changes to dynamic properties are not always noticed by normal signal spy mechanism
addChangedProperty(InstancePropertyPair(instanceForId(container.instanceId()),
container.name()));
}
}
}

View File

@@ -18,6 +18,7 @@ public:
void completeComponent(const CompleteComponentCommand &command) override;
void removeSharedMemory(const RemoveSharedMemoryCommand &command) override;
void changePropertyValues(const ChangeValuesCommand &command) override;
void changePropertyBindings(const ChangeBindingsCommand &command) override;
protected:
void collectItemChangesAndSendChangeCommands() override;

View File

@@ -540,6 +540,8 @@ void tweakObjects(QObject *object)
void createNewDynamicProperty(QObject *object, QQmlEngine *engine, const QString &name)
{
QQmlProperty qmlProp(object, name, engine->contextForObject(object));
if (!qmlProp.isValid())
QQuickDesignerSupportProperties::createNewDynamicProperty(object, engine, name);
}