[qet] [4500] New element panel : Fix double insertion of item when drop an item in the embedded collection of project |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4500
Author: blacksun
Date: 2016-05-22 18:28:40 +0200 (Sun, 22 May 2016)
Log Message:
-----------
New element panel : Fix double insertion of item when drop an item in the embedded collection of project
Modified Paths:
--------------
trunk/sources/ElementsCollection/elementscollectionmodel.cpp
Modified: trunk/sources/ElementsCollection/elementscollectionmodel.cpp
===================================================================
--- trunk/sources/ElementsCollection/elementscollectionmodel.cpp 2016-05-22 16:13:08 UTC (rev 4499)
+++ trunk/sources/ElementsCollection/elementscollectionmodel.cpp 2016-05-22 16:28:40 UTC (rev 4500)
@@ -237,6 +237,11 @@
m_parent_at_drop = parent;
+ //We temporarily disconnect for avoid double insertion of item
+ foreach (QETProject *project, m_project_list)
+ disconnect(project->embeddedElementCollection(), &XmlElementCollection::elementAdded, this, &ElementsCollectionModel::elementIntegratedToCollection);
+
+
connect(eci, &ElementCollectionItem::beginInsertRows, this, &ElementsCollectionModel::bir);
connect(eci, &ElementCollectionItem::endInsertRows, this, &ElementsCollectionModel::endInsertRows);
connect(eci, &ElementCollectionItem::beginRemoveRows, this, &ElementsCollectionModel::brr);
@@ -249,6 +254,9 @@
disconnect(eci, &ElementCollectionItem::beginRemoveRows, this, &ElementsCollectionModel::brr);
disconnect(eci, &ElementCollectionItem::endRemoveRows, this, &ElementsCollectionModel::endRemoveRows);
+ foreach(QETProject *project, m_project_list)
+ connect(project->embeddedElementCollection(), &XmlElementCollection::elementAdded, this, &ElementsCollectionModel::elementIntegratedToCollection);
+
m_parent_at_drop = QModelIndex();
return rb;