QElectroTech  0.8-dev
Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ElementsCollectionModel Class Reference

#include <elementscollectionmodel.h>

Inherits QStandardItemModel.

Collaboration diagram for ElementsCollectionModel:
Collaboration graph

Signals

void loadingProgressValueChanged (int)
 
void loadingProgressRangeChanged (int, int)
 
void loadingFinished ()
 

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 loadingProgressRangeChanged(int, int) for know the minimu and maximum progress value This method emit loadingProgressValueChanged(int) for know the current progress value This method emit loadingFinished for know when loading finished. 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. 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 location. 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
 
QFuture< void > m_future
 
QList< ElementCollectionItem * > m_items_list_to_setUp
 

Constructor & Destructor Documentation

◆ ElementsCollectionModel()

ElementsCollectionModel::ElementsCollectionModel ( QObject *  parent = Q_NULLPTR)

ElementsCollectionModel::ElementsCollectionModel Constructor.

Parameters
parent

Member Function Documentation

◆ addCommonCollection()

void ElementsCollectionModel::addCommonCollection ( bool  set_data = true)

ElementsCollectionModel::addCommonCollection Add the common elements collection to this model.

Parameters
set_data
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addCustomCollection()

void ElementsCollectionModel::addCustomCollection ( bool  set_data = true)

ElementsCollectionModel::addCustomCollection Add the custom elements collection to this model.

Parameters
set_data
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addLocation()

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.

Parameters
location
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addProject()

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

ElementsCollectionModel::addProject Add project to this model.

Parameters
project: project to add.
set_data: if true, setUpData is called for every ElementCollectionItem of project
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
Here is the call graph for this function:

◆ data()

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

ElementsCollectionModel::data Reimplemented from QStandardItemModel.

Parameters
index
role
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dropMimeData()

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

ElementsCollectionModel::dropMimeData Reimplemented from QStandardItemModel.

Parameters
data
action
row
column
parent
Returns
Here is the call graph for this function:

◆ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hideElement()

void ElementsCollectionModel::hideElement ( )

ElementsCollectionModel::hideElement Hide element in this model, only directory is managed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ highlightUnusedElement()

void ElementsCollectionModel::highlightUnusedElement ( )

ElementsCollectionModel::highlightUnusedElement Highlight every unused element of managed project.

See also
QETProject::unusedElements()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ indexFromLocation()

QModelIndex ElementsCollectionModel::indexFromLocation ( const ElementsLocation location)

ElementsCollectionModel::indexFromLocation Return the index who represent location. Index can be non valid.

Parameters
location
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isHideElement()

bool ElementsCollectionModel::isHideElement ( )
inline

◆ itemRemovedFromCollection()

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

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

Parameters
path
Here is the call graph for this function:
Here is the caller graph for this function:

◆ items()

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

ElementsCollectionModel::items.

Returns
every ElementCollectionItem owned by this model
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 loadingProgressRangeChanged(int, int) for know the minimu and maximum progress value This method emit loadingProgressValueChanged(int) for know the current progress value This method emit loadingFinished for know when loading finished.

Parameters
common_collection: true for load the common collection
custom_collection: true for load the custom collection
projects: list of projects to load
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadingFinished

void ElementsCollectionModel::loadingFinished ( )
signal
Here is the caller graph for this function:

◆ loadingProgressRangeChanged

void ElementsCollectionModel::loadingProgressRangeChanged ( int  ,
int   
)
signal
Here is the caller graph for this function:

◆ loadingProgressValueChanged

void ElementsCollectionModel::loadingProgressValueChanged ( int  )
signal
Here is the caller graph for this function:

◆ mimeData()

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

ElementsCollectionModel::mimeData Reimplemented from QStandardItemModel.

Parameters
indexes
Returns
Here is the call graph for this function:

◆ mimeTypes()

QStringList ElementsCollectionModel::mimeTypes ( ) const
override

ElementsCollectionModel::mimeTypes Reimplemented from QStandardItemModel.

Returns

◆ project()

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

ElementsCollectionModel::project.

Returns
every project added to this model
Here is the caller graph for this function:

◆ projectItems()

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

ElementsCollectionModel::projectItems.

Parameters
project
Returns
return all items for project. the list can be empty
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeProject()

void ElementsCollectionModel::removeProject ( QETProject project)

ElementsCollectionModel::removeProject Remove project from this model.

Parameters
project
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateItem()

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

ElementsCollectionModel::updateItem Update the item at path.

Parameters
path
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_future

QFuture<void> ElementsCollectionModel::m_future
private

◆ m_hide_element

bool ElementsCollectionModel::m_hide_element = false
private

◆ m_items_list_to_setUp

QList<ElementCollectionItem *> ElementsCollectionModel::m_items_list_to_setUp
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: