forked from qt-creator/qt-creator
QmlDesigner: Fix lambda unique connections for CollectionSourceModel
Fixes: QDS-11572 Change-Id: I25f3cbd8b6f806c347102ddea3855c23b30bf8f9 Reviewed-by: Shrief Gabr <shrief.gabr@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -646,20 +646,28 @@ void CollectionSourceModel::registerCollection(const QSharedPointer<CollectionLi
|
|||||||
if (collectionList == nullptr)
|
if (collectionList == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
connect(collectionList, &CollectionListModel::selectedIndexChanged, this,
|
if (!collectionList->property("_is_registered_in_sourceModel").toBool()) {
|
||||||
[this, collectionList](int idx) {
|
collectionList->setProperty("_is_registered_in_sourceModel", true);
|
||||||
onSelectedCollectionChanged(collectionList, idx);
|
|
||||||
}, Qt::UniqueConnection);
|
|
||||||
|
|
||||||
connect(collectionList, &CollectionListModel::collectionNameChanged, this,
|
connect(collectionList,
|
||||||
[this, collectionList](const QString &oldName, const QString &newName) {
|
&CollectionListModel::selectedIndexChanged,
|
||||||
onCollectionNameChanged(collectionList, oldName, newName);
|
this,
|
||||||
}, Qt::UniqueConnection);
|
[this, collectionList](int idx) { onSelectedCollectionChanged(collectionList, idx); });
|
||||||
|
|
||||||
connect(collectionList, &CollectionListModel::collectionsRemoved, this,
|
connect(collectionList,
|
||||||
[this, collectionList](const QStringList &removedCollections) {
|
&CollectionListModel::collectionNameChanged,
|
||||||
onCollectionsRemoved(collectionList, removedCollections);
|
this,
|
||||||
}, Qt::UniqueConnection);
|
[this, collectionList](const QString &oldName, const QString &newName) {
|
||||||
|
onCollectionNameChanged(collectionList, oldName, newName);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(collectionList,
|
||||||
|
&CollectionListModel::collectionsRemoved,
|
||||||
|
this,
|
||||||
|
[this, collectionList](const QStringList &removedCollections) {
|
||||||
|
onCollectionsRemoved(collectionList, removedCollections);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (collectionList->sourceNode().isValid())
|
if (collectionList->sourceNode().isValid())
|
||||||
emit collectionNamesInitialized(collection->stringList());
|
emit collectionNamesInitialized(collection->stringList());
|
||||||
|
Reference in New Issue
Block a user