From faf44a64981a069c4c33bd7f75559e1d14bb4db7 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 14 Mar 2025 15:54:17 +0100 Subject: [PATCH] QmlDesigner: Add missing callback for adding signals If a signal is added we have to add/update the property. Task-number: QDS-14449 Change-Id: I8c4071a3fbba7f880d81dd697b15a2649d8acb10 Reviewed-by: Miikka Heikkinen --- .../components/connectioneditor/connectionview.cpp | 7 +++++++ .../components/connectioneditor/connectionview.h | 3 +++ .../components/connectioneditor/dynamicpropertiesmodel.cpp | 2 +- .../components/propertyeditor/propertyeditorview.cpp | 7 +++++++ .../components/propertyeditor/propertyeditorview.h | 3 +++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp index aa81e7c06de..7e2ce37acb1 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp @@ -258,6 +258,13 @@ void ConnectionView::bindingPropertiesChanged(const QList &prop } } +void ConnectionView::signalDeclarationPropertiesChanged( + const QVector &propertyList, PropertyChangeFlags /* propertyChange */) +{ + for (const SignalDeclarationProperty &property : propertyList) + d->dynamicPropertiesModel.updateItem(property); +} + void ConnectionView::signalHandlerPropertiesChanged(const QVector &propertyList, AbstractView::PropertyChangeFlags /*propertyChange*/) { diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionview.h b/src/plugins/qmldesigner/components/connectioneditor/connectionview.h index e06f1702892..ab64fd937df 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionview.h +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionview.h @@ -50,6 +50,9 @@ public: void bindingPropertiesChanged(const QList& propertyList, PropertyChangeFlags propertyChange) override; void signalHandlerPropertiesChanged(const QVector& propertyList, PropertyChangeFlags propertyChange) override; + void signalDeclarationPropertiesChanged(const QVector &propertyList, + PropertyChangeFlags propertyChange) override; + void selectedNodesChanged(const QList &selectedNodeList, const QList &lastSelectedNodeList) override; diff --git a/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp index 7606456871d..d98af6c0e1f 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp @@ -148,7 +148,7 @@ void DynamicPropertiesModel::setCurrent(int internalId, PropertyNameView name) void DynamicPropertiesModel::updateItem(const AbstractProperty &property) { - if (!property.isDynamic()) + if (!property.isDynamic() && !property.isSignalDeclarationProperty()) return; if (auto *item = itemForProperty(property)) { diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index 6244e1d005c..8e0f63a3112 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -1092,6 +1092,13 @@ void PropertyEditorView::auxiliaryDataChanged(const ModelNode &node, m_qmlBackEndForCurrentType->contextObject()->setInsightCategories(data.toStringList()); } +void PropertyEditorView::signalDeclarationPropertiesChanged( + const QVector &propertyList, PropertyChangeFlags /* propertyChange */) +{ + for (const SignalDeclarationProperty &property : propertyList) + m_dynamicPropertiesModel->updateItem(property); +} + void PropertyEditorView::instanceInformationsChanged(const QMultiHash &informationChangedHash) { if (noValidSelection()) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.h index ee1f6ad5a76..65773ec6f87 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.h @@ -59,6 +59,9 @@ public: AuxiliaryDataKeyView key, const QVariant &data) override; + void signalDeclarationPropertiesChanged(const QVector &propertyList, + PropertyChangeFlags propertyChange) override; + void instanceInformationsChanged(const QMultiHash &informationChangedHash) override; void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId) override;