QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
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.
 
QVariant data (const QModelIndex &index, int role) const override
 ElementsCollectionModel::data Reimplemented from QStandardItemModel.
 
QMimeData * mimeData (const QModelIndexList &indexes) const override
 ElementsCollectionModel::mimeData Reimplemented from QStandardItemModel.
 
QStringList mimeTypes () const override
 ElementsCollectionModel::mimeTypes Reimplemented from QStandardItemModel.
 
bool canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override
 ElementsCollectionModel::canDropMimeData Reimplemented from QStandardItemModel.
 
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 ElementsCollectionModel::dropMimeData Reimplemented from QStandardItemModel.
 
void loadCollections (bool common_collection, bool company_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.
 
void addCommonCollection (bool set_data=true)
 ElementsCollectionModel::addCommonCollection Add the common elements collection to this model.
 
void addCompanyCollection (bool set_data=true)
 ElementsCollectionModel::addCompanyCollection Add the company elements collection to this model.
 
void addCustomCollection (bool set_data=true)
 ElementsCollectionModel::addCustomCollection Add the custom elements collection to this model.
 
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.
 
void addProject (QETProject *project, bool set_data=true)
 ElementsCollectionModel::addProject Add project to this model.
 
void removeProject (QETProject *project)
 ElementsCollectionModel::removeProject Remove project from this model.
 
QList< QETProject * > project () const
 ElementsCollectionModel::project.
 
void highlightUnusedElement ()
 ElementsCollectionModel::highlightUnusedElement Highlight every unused element of managed project.
 
QList< ElementCollectionItem * > items () const
 ElementsCollectionModel::items.
 
QList< ElementCollectionItem * > projectItems (QETProject *project) const
 ElementsCollectionModel::projectItems.
 
void hideElement ()
 ElementsCollectionModel::hideElement Hide element in this model, only directory is managed.
 
bool isHideElement ()
 
QModelIndex indexFromLocation (const ElementsLocation &location)
 ElementsCollectionModel::indexFromLocation Return the index who represent location. Index can be non valid.
 

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.
 
void itemRemovedFromCollection (const QString &path)
 ElementsCollectionModel::itemRemovedFromCollection This method must be called by a signal, to get a sender.
 
void updateItem (const QString &path)
 ElementsCollectionModel::updateItem Update the item at path.
 

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:

◆ addCompanyCollection()

void ElementsCollectionModel::addCompanyCollection ( bool  set_data = true)

ElementsCollectionModel::addCompanyCollection Add the company 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  company_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: