mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
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:
@@ -237,6 +237,11 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
|||||||
|
|
||||||
m_parent_at_drop = parent;
|
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::beginInsertRows, this, &ElementsCollectionModel::bir);
|
||||||
connect(eci, &ElementCollectionItem::endInsertRows, this, &ElementsCollectionModel::endInsertRows);
|
connect(eci, &ElementCollectionItem::endInsertRows, this, &ElementsCollectionModel::endInsertRows);
|
||||||
connect(eci, &ElementCollectionItem::beginRemoveRows, this, &ElementsCollectionModel::brr);
|
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::beginRemoveRows, this, &ElementsCollectionModel::brr);
|
||||||
disconnect(eci, &ElementCollectionItem::endRemoveRows, this, &ElementsCollectionModel::endRemoveRows);
|
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();
|
m_parent_at_drop = QModelIndex();
|
||||||
|
|
||||||
return rb;
|
return rb;
|
||||||
|
|||||||
Reference in New Issue
Block a user