mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
When add a new project, load only items of project, instead of reload every items owned by the model
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4616 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -224,15 +224,22 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
||||
*/
|
||||
void ElementsCollectionModel::loadCollections(bool common_collection, bool custom_collection, QList<QETProject *> projects)
|
||||
{
|
||||
QList <ElementCollectionItem *> list;
|
||||
|
||||
if (common_collection)
|
||||
addCommonCollection(false);
|
||||
if (custom_collection)
|
||||
addCustomCollection(false);
|
||||
|
||||
foreach (QETProject *project, projects)
|
||||
addProject(project, false);
|
||||
if (common_collection || custom_collection)
|
||||
list.append(items());
|
||||
|
||||
|
||||
foreach (QETProject *project, projects) {
|
||||
addProject(project, false);
|
||||
list.append(projectItems(project));
|
||||
}
|
||||
|
||||
QList <ElementCollectionItem *> list = items();
|
||||
QFuture<void> futur = QtConcurrent::map(list, setUpData);
|
||||
emit loadingMaxValue(futur.progressMaximum());
|
||||
while (futur.isRunning()) {
|
||||
@@ -419,6 +426,24 @@ QList <ElementCollectionItem *> ElementsCollectionModel::items() const
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::projectItems
|
||||
* @param project
|
||||
* @return return all items for project @project. the list can be empty
|
||||
*/
|
||||
QList<ElementCollectionItem *> ElementsCollectionModel::projectItems(QETProject *project) const
|
||||
{
|
||||
QList <ElementCollectionItem *> list;
|
||||
|
||||
if (m_project_list.contains(project)) {
|
||||
ElementCollectionItem *eci = m_project_hash.value(project);
|
||||
list.append(eci);
|
||||
list.append(eci->items());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::hideElement
|
||||
* Hide element in this model, only directory is managed
|
||||
|
||||
Reference in New Issue
Block a user