New element panel : Fix double insertion of item when drop an item in the embedded collection of project

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4500 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2016-05-22 16:28:40 +00:00
parent ea69d0b33c
commit 8555b1a1f2

View File

@@ -237,6 +237,11 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
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 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
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;