QElectroTech
0.70
|
#include <elementscollectionmodel.h>
Signals | |
void | loadingMaxValue (int) |
void | loadingProgressValue (int) |
Public Member Functions | |
ElementsCollectionModel (QObject *parent=Q_NULLPTR) | |
ElementsCollectionModel::ElementsCollectionModel Constructor. More... | |
QVariant | data (const QModelIndex &index, int role) const override |
ElementsCollectionModel::data Reimplemented from QStandardItemModel. More... | |
QMimeData * | mimeData (const QModelIndexList &indexes) const override |
ElementsCollectionModel::mimeData Reimplemented from QStandardItemModel. More... | |
QStringList | mimeTypes () const override |
ElementsCollectionModel::mimeTypes Reimplemented from QStandardItemModel. More... | |
bool | canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override |
ElementsCollectionModel::canDropMimeData Reimplemented from QStandardItemModel. More... | |
bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
ElementsCollectionModel::dropMimeData Reimplemented from QStandardItemModel. More... | |
void | loadCollections (bool common_collection, bool custom_collection, QList< QETProject *> projects) |
ElementsCollectionModel::loadCollections Load the several collections in this model. Prefer use this method instead of addCommonCollection, addCustomCollection and addProject, because it use multithreading to speed up the loading. This method emit loadingMaxValue(int) for know the maximum progress value This method emit loadingProgressValue(int) for know the current progress value. More... | |
void | addCommonCollection (bool set_data=true) |
ElementsCollectionModel::addCommonCollection Add the common elements collection to this model. More... | |
void | addCustomCollection (bool set_data=true) |
ElementsCollectionModel::addCustomCollection Add the custom elements collection to this model. More... | |
void | addLocation (const ElementsLocation &location) |
ElementsCollectionModel::addLocation Add the element or directory to this model. If the location is already managed by this model, do nothing. More... | |
void | addProject (QETProject *project, bool set_data=true) |
ElementsCollectionModel::addProject Add project to this model. More... | |
void | removeProject (QETProject *project) |
ElementsCollectionModel::removeProject Remove project from this model. More... | |
QList< QETProject * > | project () const |
ElementsCollectionModel::project. More... | |
void | highlightUnusedElement () |
ElementsCollectionModel::highlightUnusedElement Highlight every unused element of managed project. QETProject::unusedElements() More... | |
QList< ElementCollectionItem * > | items () const |
ElementsCollectionModel::items. More... | |
QList< ElementCollectionItem * > | projectItems (QETProject *project) const |
ElementsCollectionModel::projectItems. More... | |
void | hideElement () |
ElementsCollectionModel::hideElement Hide element in this model, only directory is managed. More... | |
bool | isHideElement () |
QModelIndex | indexFromLocation (const ElementsLocation &location) |
ElementsCollectionModel::indexFromLocation Return the index who represent . Index can be non valid. More... | |
Private Member Functions | |
void | elementIntegratedToCollection (const QString &path) |
ElementsCollectionModel::elementIntegratedToCollection When an element is added to embedded collection of a project, this method create and display the new element. More... | |
void | itemRemovedFromCollection (const QString &path) |
ElementsCollectionModel::itemRemovedFromCollection This method must be called by a signal, to get a sender. More... | |
void | updateItem (const QString &path) |
ElementsCollectionModel::updateItem Update the item at path. More... | |
Private Attributes | |
QList< QETProject * > | m_project_list |
QHash< QETProject *, XmlProjectElementCollectionItem * > | m_project_hash |
bool | m_hide_element = false |
Definition at line 31 of file elementscollectionmodel.h.
ElementsCollectionModel::ElementsCollectionModel | ( | QObject * | parent = Q_NULLPTR | ) |
ElementsCollectionModel::ElementsCollectionModel Constructor.
parent |
Definition at line 34 of file elementscollectionmodel.cpp.
void ElementsCollectionModel::addCommonCollection | ( | bool | set_data = true | ) |
ElementsCollectionModel::addCommonCollection Add the common elements collection to this model.
Definition at line 255 of file elementscollectionmodel.cpp.
References QETApp::commonElementsDirN(), m_hide_element, FileElementCollectionItem::setRootPath(), and FileElementCollectionItem::setUpData().
Referenced by loadCollections().
void ElementsCollectionModel::addCustomCollection | ( | bool | set_data = true | ) |
ElementsCollectionModel::addCustomCollection Add the custom elements collection to this model.
Definition at line 271 of file elementscollectionmodel.cpp.
References QETApp::customElementsDirN(), m_hide_element, FileElementCollectionItem::setRootPath(), and FileElementCollectionItem::setUpData().
Referenced by NewElementWizard::buildStep1(), and loadCollections().
void ElementsCollectionModel::addLocation | ( | const ElementsLocation & | location | ) |
ElementsCollectionModel::addLocation Add the element or directory to this model. If the location is already managed by this model, do nothing.
location |
Definition at line 289 of file elementscollectionmodel.cpp.
References ElementCollectionItem::addChildAtPath(), ElementsLocation::collectionPath(), indexFromLocation(), FileElementCollectionItem::isCustomCollection(), ElementsLocation::isCustomCollection(), ElementsLocation::isProject(), ElementCollectionItem::lastItemForPath(), m_project_hash, project(), ElementsLocation::project(), FileElementCollectionItem::Type, and ElementCollectionItem::type().
Referenced by ElementsCollectionWidget::locationWasSaved(), and ElementsCollectionWidget::newDirectory().
void ElementsCollectionModel::addProject | ( | QETProject * | project, |
bool | set_data = true |
||
) |
ElementsCollectionModel::addProject Add project to this model.
project | : project to add. |
set_data | : if true, setUpData is called for every ElementCollectionItem of project |
Definition at line 337 of file elementscollectionmodel.cpp.
References XmlElementCollection::directoryRemoved(), XmlElementCollection::elementAdded(), XmlElementCollection::elementChanged(), elementIntegratedToCollection(), XmlElementCollection::elementRemoved(), itemRemovedFromCollection(), m_project_hash, m_project_list, project(), XmlProjectElementCollectionItem::setProject(), XmlProjectElementCollectionItem::setUpData(), and updateItem().
Referenced by loadCollections().
|
override |
ElementsCollectionModel::canDropMimeData Reimplemented from QStandardItemModel.
data | |
action | |
row | |
column | |
parent |
Definition at line 109 of file elementscollectionmodel.cpp.
References data(), and FileElementCollectionItem::Type.
|
override |
ElementsCollectionModel::data Reimplemented from QStandardItemModel.
index | |
role |
Definition at line 46 of file elementscollectionmodel.cpp.
References FileElementCollectionItem::Type, and XmlProjectElementCollectionItem::Type.
Referenced by canDropMimeData(), and dropMimeData().
|
override |
ElementsCollectionModel::dropMimeData Reimplemented from QStandardItemModel.
data | |
action | |
row | |
column | |
parent |
Definition at line 149 of file elementscollectionmodel.cpp.
References FileElementCollectionItem::addChildAtPath(), XmlProjectElementCollectionItem::collectionPath(), ElementCollectionHandler::copy(), data(), ElementsLocation::exist(), FileElementCollectionItem::fileSystemPath(), FileElementCollectionItem::isCommonCollection(), XmlProjectElementCollectionItem::isElement(), FileElementCollectionItem::isElement(), FileElementCollectionItem::Type, FileElementCollectionItem::type(), XmlProjectElementCollectionItem::Type, and XmlProjectElementCollectionItem::type().
|
private |
ElementsCollectionModel::elementIntegratedToCollection When an element is added to embedded collection of a project, this method create and display the new element.
path | -The path of the new element in the embedded collection of a project |
Definition at line 507 of file elementscollectionmodel.cpp.
References ElementCollectionItem::addChildAtPath(), QETProject::embeddedElementCollection(), ElementCollectionItem::lastItemForPath(), m_project_hash, m_project_list, and project().
Referenced by addProject(), and removeProject().
void ElementsCollectionModel::hideElement | ( | ) |
ElementsCollectionModel::hideElement Hide element in this model, only directory is managed.
Definition at line 452 of file elementscollectionmodel.cpp.
References ElementCollectionItem::isElement(), items(), and m_hide_element.
Referenced by NewElementWizard::buildStep1().
void ElementsCollectionModel::highlightUnusedElement | ( | ) |
ElementsCollectionModel::highlightUnusedElement Highlight every unused element of managed project. QETProject::unusedElements()
Definition at line 392 of file elementscollectionmodel.cpp.
References indexFromLocation(), m_project_list, and project().
Referenced by ElementsCollectionWidget::addProject(), ElementsCollectionWidget::highlightUnusedElement(), and ElementsCollectionWidget::reload().
QModelIndex ElementsCollectionModel::indexFromLocation | ( | const ElementsLocation & | location | ) |
ElementsCollectionModel::indexFromLocation Return the index who represent . Index can be non valid.
location |
Definition at line 469 of file elementscollectionmodel.cpp.
References ElementsLocation::collectionPath(), ElementsLocation::isCommonCollection(), ElementsLocation::isCustomCollection(), ElementCollectionItem::itemAtPath(), FileElementCollectionItem::Type, ElementCollectionItem::type(), and XmlProjectElementCollectionItem::Type.
Referenced by addLocation(), highlightUnusedElement(), itemRemovedFromCollection(), ElementsCollectionWidget::locationWasSaved(), NewElementWizard::preselectedLocation(), and ElementsCollectionWidget::setCurrentLocation().
|
inline |
Definition at line 59 of file elementscollectionmodel.h.
References m_hide_element.
|
private |
ElementsCollectionModel::itemRemovedFromCollection This method must be called by a signal, to get a sender.
path |
Definition at line 540 of file elementscollectionmodel.cpp.
References QETProject::embeddedElementCollection(), indexFromLocation(), m_project_list, and project().
Referenced by addProject(), and removeProject().
QList< ElementCollectionItem * > ElementsCollectionModel::items | ( | ) | const |
ElementsCollectionModel::items.
Definition at line 417 of file elementscollectionmodel.cpp.
References ElementCollectionItem::items().
Referenced by hideElement(), and loadCollections().
void ElementsCollectionModel::loadCollections | ( | bool | common_collection, |
bool | custom_collection, | ||
QList< QETProject *> | projects | ||
) |
ElementsCollectionModel::loadCollections Load the several collections in this model. Prefer use this method instead of addCommonCollection, addCustomCollection and addProject, because it use multithreading to speed up the loading. This method emit loadingMaxValue(int) for know the maximum progress value This method emit loadingProgressValue(int) for know the current progress value.
common_collection | : true for load the common collection |
custom_collection | : true for load the custom collection |
projects | : list of projects to load |
Definition at line 226 of file elementscollectionmodel.cpp.
References addCommonCollection(), addCustomCollection(), addProject(), items(), loadingMaxValue(), loadingProgressValue(), project(), projectItems(), and setUpData().
Referenced by ElementsCollectionWidget::addProject(), ElementsCollectionWidget::reload(), and ElementDialog::setUpWidget().
|
signal |
Referenced by ElementsCollectionWidget::addProject(), loadCollections(), and ElementsCollectionWidget::reload().
|
signal |
Referenced by ElementsCollectionWidget::addProject(), loadCollections(), and ElementsCollectionWidget::reload().
|
override |
ElementsCollectionModel::mimeData Reimplemented from QStandardItemModel.
indexes |
Definition at line 66 of file elementscollectionmodel.cpp.
References ElementCollectionItem::collectionPath(), and ElementCollectionItem::isElement().
|
override |
ElementsCollectionModel::mimeTypes Reimplemented from QStandardItemModel.
Definition at line 92 of file elementscollectionmodel.cpp.
QList< QETProject * > ElementsCollectionModel::project | ( | ) | const |
ElementsCollectionModel::project.
Definition at line 382 of file elementscollectionmodel.cpp.
References m_project_list.
Referenced by addLocation(), addProject(), elementIntegratedToCollection(), highlightUnusedElement(), itemRemovedFromCollection(), loadCollections(), projectItems(), ElementsCollectionWidget::reload(), removeProject(), and updateItem().
QList< ElementCollectionItem * > ElementsCollectionModel::projectItems | ( | QETProject * | project | ) | const |
ElementsCollectionModel::projectItems.
project |
Definition at line 435 of file elementscollectionmodel.cpp.
References ElementCollectionItem::items(), m_project_hash, m_project_list, and project().
Referenced by loadCollections().
void ElementsCollectionModel::removeProject | ( | QETProject * | project | ) |
ElementsCollectionModel::removeProject Remove project from this model.
project |
Definition at line 362 of file elementscollectionmodel.cpp.
References XmlElementCollection::directoryRemoved(), XmlElementCollection::elementAdded(), XmlElementCollection::elementChanged(), elementIntegratedToCollection(), XmlElementCollection::elementRemoved(), itemRemovedFromCollection(), m_project_hash, m_project_list, project(), and updateItem().
Referenced by ElementsCollectionWidget::removeProject().
|
private |
ElementsCollectionModel::updateItem Update the item at path.
path |
Definition at line 568 of file elementscollectionmodel.cpp.
References ElementCollectionItem::clearData(), QETProject::embeddedElementCollection(), m_project_hash, m_project_list, project(), and ElementCollectionItem::setUpData().
Referenced by addProject(), and removeProject().
|
private |
Definition at line 74 of file elementscollectionmodel.h.
Referenced by addCommonCollection(), addCustomCollection(), hideElement(), and isHideElement().
|
private |
Definition at line 73 of file elementscollectionmodel.h.
Referenced by addLocation(), addProject(), elementIntegratedToCollection(), projectItems(), removeProject(), and updateItem().
|
private |
Definition at line 72 of file elementscollectionmodel.h.
Referenced by addProject(), elementIntegratedToCollection(), highlightUnusedElement(), itemRemovedFromCollection(), project(), projectItems(), removeProject(), and updateItem().