QElectroTech  0.70
Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ElementsCollectionModel Class Reference

#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
 

Detailed Description

Definition at line 31 of file elementscollectionmodel.h.

Constructor & Destructor Documentation

◆ ElementsCollectionModel()

ElementsCollectionModel::ElementsCollectionModel ( QObject *  parent = Q_NULLPTR)

ElementsCollectionModel::ElementsCollectionModel Constructor.

Parameters
parent

Definition at line 34 of file elementscollectionmodel.cpp.

Member Function Documentation

◆ addCommonCollection()

void ElementsCollectionModel::addCommonCollection ( bool  set_data = true)

◆ addCustomCollection()

void ElementsCollectionModel::addCustomCollection ( bool  set_data = true)

◆ addLocation()

void ElementsCollectionModel::addLocation ( const ElementsLocation location)

◆ addProject()

void ElementsCollectionModel::addProject ( QETProject project,
bool  set_data = true 
)

◆ canDropMimeData()

bool ElementsCollectionModel::canDropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
) const
override

ElementsCollectionModel::canDropMimeData Reimplemented from QStandardItemModel.

Parameters
data
action
row
column
parent
Returns

Definition at line 109 of file elementscollectionmodel.cpp.

References data(), and FileElementCollectionItem::Type.

◆ data()

QVariant ElementsCollectionModel::data ( const QModelIndex &  index,
int  role 
) const
override

ElementsCollectionModel::data Reimplemented from QStandardItemModel.

Parameters
index
role
Returns

Definition at line 46 of file elementscollectionmodel.cpp.

References FileElementCollectionItem::Type, and XmlProjectElementCollectionItem::Type.

Referenced by canDropMimeData(), and dropMimeData().

◆ dropMimeData()

bool ElementsCollectionModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)
override

◆ elementIntegratedToCollection()

void ElementsCollectionModel::elementIntegratedToCollection ( const QString &  path)
private

ElementsCollectionModel::elementIntegratedToCollection When an element is added to embedded collection of a project, this method create and display the new element.

Parameters
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().

◆ hideElement()

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().

◆ highlightUnusedElement()

void ElementsCollectionModel::highlightUnusedElement ( )

◆ indexFromLocation()

QModelIndex ElementsCollectionModel::indexFromLocation ( const ElementsLocation location)

◆ isHideElement()

bool ElementsCollectionModel::isHideElement ( )
inline

Definition at line 59 of file elementscollectionmodel.h.

References m_hide_element.

◆ itemRemovedFromCollection()

void ElementsCollectionModel::itemRemovedFromCollection ( const QString &  path)
private

ElementsCollectionModel::itemRemovedFromCollection This method must be called by a signal, to get a sender.

Parameters
path

Definition at line 540 of file elementscollectionmodel.cpp.

References QETProject::embeddedElementCollection(), indexFromLocation(), m_project_list, and project().

Referenced by addProject(), and removeProject().

◆ items()

QList< ElementCollectionItem * > ElementsCollectionModel::items ( ) const

ElementsCollectionModel::items.

Returns
every ElementCollectionItem owned by this model

Definition at line 417 of file elementscollectionmodel.cpp.

References ElementCollectionItem::items().

Referenced by hideElement(), and loadCollections().

◆ 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.

Parameters
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().

◆ loadingMaxValue

void ElementsCollectionModel::loadingMaxValue ( int  )
signal

◆ loadingProgressValue

void ElementsCollectionModel::loadingProgressValue ( int  )
signal

◆ mimeData()

QMimeData * ElementsCollectionModel::mimeData ( const QModelIndexList &  indexes) const
override

ElementsCollectionModel::mimeData Reimplemented from QStandardItemModel.

Parameters
indexes
Returns

Definition at line 66 of file elementscollectionmodel.cpp.

References ElementCollectionItem::collectionPath(), and ElementCollectionItem::isElement().

◆ mimeTypes()

QStringList ElementsCollectionModel::mimeTypes ( ) const
override

ElementsCollectionModel::mimeTypes Reimplemented from QStandardItemModel.

Returns

Definition at line 92 of file elementscollectionmodel.cpp.

◆ project()

QList< QETProject * > ElementsCollectionModel::project ( ) const

◆ projectItems()

QList< ElementCollectionItem * > ElementsCollectionModel::projectItems ( QETProject project) const

ElementsCollectionModel::projectItems.

Parameters
project
Returns
return all items for project . the list can be empty

Definition at line 435 of file elementscollectionmodel.cpp.

References ElementCollectionItem::items(), m_project_hash, m_project_list, and project().

Referenced by loadCollections().

◆ removeProject()

void ElementsCollectionModel::removeProject ( QETProject project)

◆ updateItem()

void ElementsCollectionModel::updateItem ( const QString &  path)
private

Member Data Documentation

◆ m_hide_element

bool ElementsCollectionModel::m_hide_element = false
private

◆ m_project_hash

QHash<QETProject *, XmlProjectElementCollectionItem *> ElementsCollectionModel::m_project_hash
private

◆ m_project_list

QList<QETProject *> ElementsCollectionModel::m_project_list
private

The documentation for this class was generated from the following files: