From fe7d928f3b00cf5652fb0d8633bac122f3d1d489 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 5 Oct 2020 10:16:54 +0200 Subject: [PATCH] QmlDesigner: Do not keep separate selection state When nodes are deleted the selection can changes without a notifier. There is no reason to keep the selection separately. Change-Id: I166d3695762e3d5cd6ff4808586384fd26bafef4 Reviewed-by: Miikka Heikkinen --- .../components/connectioneditor/bindingmodel.cpp | 7 +++---- .../qmldesigner/components/connectioneditor/bindingmodel.h | 1 - .../components/connectioneditor/dynamicpropertiesmodel.cpp | 7 +++---- .../components/connectioneditor/dynamicpropertiesmodel.h | 1 - 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp index 55220d123b1..8f15a18c94f 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp @@ -53,10 +53,10 @@ void BindingModel::resetModel() { beginResetModel(); clear(); - setHorizontalHeaderLabels(QStringList({ tr("Item"), tr("Property"), tr("Source Item"), - tr("Source Property") })); + setHorizontalHeaderLabels( + QStringList({tr("Item"), tr("Property"), tr("Source Item"), tr("Source Property")})); - foreach (const ModelNode modelNode, m_selectedModelNodes) + for (const ModelNode modelNode : connectionView()->selectedModelNodes()) addModelNode(modelNode); endResetModel(); @@ -100,7 +100,6 @@ void BindingModel::bindingRemoved(const BindingProperty &bindingProperty) void BindingModel::selectionChanged(const QList &selectedNodes) { m_handleDataChanged = false; - m_selectedModelNodes = selectedNodes; resetModel(); m_handleDataChanged = true; } diff --git a/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.h b/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.h index 480ba254ad6..79e46a9a431 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.h +++ b/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.h @@ -80,7 +80,6 @@ private: void handleException(); private: - QList m_selectedModelNodes; ConnectionView *m_connectionView; bool m_lock = false; bool m_handleDataChanged = false; diff --git a/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp index 5af183e6b11..c1f27f16e73 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp @@ -128,10 +128,10 @@ void DynamicPropertiesModel::resetModel() { beginResetModel(); clear(); - setHorizontalHeaderLabels(QStringList({ tr("Item"), tr("Property"), tr("Property Type"), - tr("Property Value") })); + setHorizontalHeaderLabels( + QStringList({tr("Item"), tr("Property"), tr("Property Type"), tr("Property Value")})); - foreach (const ModelNode modelNode, m_selectedModelNodes) + for (const ModelNode modelNode : connectionView()->selectedModelNodes()) addModelNode(modelNode); endResetModel(); @@ -279,7 +279,6 @@ void DynamicPropertiesModel::bindingRemoved(const BindingProperty &bindingProper void DynamicPropertiesModel::selectionChanged(const QList &selectedNodes) { m_handleDataChanged = false; - m_selectedModelNodes = selectedNodes; resetModel(); m_handleDataChanged = true; } diff --git a/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.h b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.h index 1d71c1230e0..3b7d0cf4231 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.h +++ b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.h @@ -96,7 +96,6 @@ private: void handleException(); private: - QList m_selectedModelNodes; ConnectionView *m_connectionView; bool m_lock = false; bool m_handleDataChanged = false;