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

#include <elementspanel.h>

Inheritance diagram for ElementsPanel:
Inheritance graph
Collaboration diagram for ElementsPanel:
Collaboration graph

Public Slots

void slot_doubleClick (QTreeWidgetItem *, int)
 
void reload (bool=false)
 ElementsPanel::reload Reload the elements tree. More...
 
void filter (const QString &, QET::Filtering=QET::RegularFilter)
 
void projectWasOpened (QETProject *)
 
void projectWasClosed (QETProject *)
 
void buildFilterList ()
 
void applyCurrentFilter (const QList< QTreeWidgetItem * > &)
 
void ensureHierarchyIsVisible (const QList< QTreeWidgetItem * > &)
 

Signals

void requestForProject (QETProject *)
 
void requestForDiagram (Diagram *)
 
void requestForTitleBlockTemplate (const TitleBlockTemplateLocation &)
 
- Signals inherited from GenericPanel
bool firstActivated ()
 
void panelContentChanged ()
 

Public Member Functions

 ElementsPanel (QWidget *=nullptr)
 
 ~ElementsPanel () override
 
QString dirPathForItem (QTreeWidgetItem *)
 ElementsPanel::dirPathForItem. More...
 
QString filePathForItem (QTreeWidgetItem *)
 ElementsPanel::filePathForItem. More...
 
- Public Member Functions inherited from GenericPanel
 GenericPanel (QWidget *=nullptr)
 
 ~GenericPanel () override
 
virtual int currentItemType ()
 
virtual QETProjectprojectForItem (QTreeWidgetItem *) const
 GenericPanel::projectForItem. More...
 
virtual DiagramdiagramForItem (QTreeWidgetItem *) const
 GenericPanel::diagramForItem. More...
 
virtual TitleBlockTemplateLocation templateLocationForItem (QTreeWidgetItem *) const
 GenericPanel::templateLocationForItem. More...
 
virtual QETProjectselectedProject () const
 GenericPanel::selectedProject. More...
 
virtual DiagramselectedDiagram () const
 GenericPanel::selectedDiagram. More...
 
virtual TitleBlockTemplateLocation selectedTemplateLocation () const
 GenericPanel::selectedTemplateLocation. More...
 
virtual QTreeWidgetItem * itemForProject (QETProject *)
 
virtual QTreeWidgetItem * addDiagram (Diagram *, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild)
 GenericPanel::addDiagram. More...
 
virtual QTreeWidgetItem * addTemplatesCollection (TitleBlockTemplatesCollection *, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild)
 GenericPanel::addTemplatesCollection. More...
 
virtual QTreeWidgetItem * itemForTemplatesCollection (TitleBlockTemplatesCollection *)
 GenericPanel::itemForTemplatesCollection. More...
 
virtual QTreeWidgetItem * addTemplate (const TitleBlockTemplateLocation &, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild)
 GenericPanel::addTemplate. More...
 

Protected Slots

void panelContentChange ()
 
- Protected Slots inherited from GenericPanel
virtual void projectInformationsChanged (QETProject *)
 GenericPanel::projectInformationsChanged. More...
 
virtual void diagramAdded (QETProject *, Diagram *)
 GenericPanel::diagramAdded. More...
 
virtual void diagramRemoved (QETProject *, Diagram *)
 GenericPanel::diagramRemoved. More...
 
virtual void projectDiagramsOrderChanged (QETProject *, int, int)
 GenericPanel::projectDiagramsOrderChanged. More...
 
virtual void diagramTitleChanged (Diagram *, const QString &)
 GenericPanel::diagramTitleChanged Inform this panel the diagram diagram has changed its title to title. More...
 
virtual void templatesCollectionChanged (TitleBlockTemplatesCollection *, const QString &)
 GenericPanel::templatesCollectionChanged. More...
 
virtual void diagramUsedTemplate (TitleBlockTemplatesCollection *, const QString &)
 GenericPanel::diagramUsedTemplate. More...
 

Protected Member Functions

void startDrag (Qt::DropActions) override
 
void startTitleBlockTemplateDrag (const TitleBlockTemplateLocation &)
 
bool matchesFilter (const QTreeWidgetItem *, const QString &) const
 
- Protected Member Functions inherited from GenericPanel
virtual QTreeWidgetItem * getItemForProject (QETProject *, bool *=nullptr)
 
virtual QTreeWidgetItem * updateProjectItem (QTreeWidgetItem *, QETProject *, PanelOptions=AddAllChild, bool=false)
 GenericPanel::updateProjectItem. More...
 
virtual QTreeWidgetItem * fillProjectItem (QTreeWidgetItem *, QETProject *, PanelOptions=AddAllChild, bool=false)
 GenericPanel::fillProjectItem. More...
 
virtual QTreeWidgetItem * getItemForDiagram (Diagram *, bool *=nullptr)
 GenericPanel::getItemForDiagram. More...
 
virtual QTreeWidgetItem * updateDiagramItem (QTreeWidgetItem *, Diagram *, PanelOptions=AddAllChild, bool=false)
 GenericPanel::updateDiagramItem. More...
 
virtual QTreeWidgetItem * fillDiagramItem (QTreeWidgetItem *, Diagram *, PanelOptions=AddAllChild, bool=false)
 GenericPanel::fillDiagramItem. More...
 
virtual QTreeWidgetItem * getItemForTemplatesCollection (TitleBlockTemplatesCollection *, bool *=nullptr)
 GenericPanel::getItemForTemplatesCollection. More...
 
virtual QTreeWidgetItem * fillTemplatesCollectionItem (QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions=AddAllChild, bool=false)
 GenericPanel::fillTemplatesCollectionItem. More...
 
virtual QTreeWidgetItem * getItemForTemplate (const TitleBlockTemplateLocation &, bool *=nullptr)
 GenericPanel::getItemForTemplate. More...
 
virtual QTreeWidgetItem * fillTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions=AddAllChild, bool=false)
 GenericPanel::fillTemplateItem. More...
 
virtual QTreeWidgetItem * updateItem (QTreeWidgetItem *, PanelOptions=AddAllChild, bool=false)
 GenericPanel::updateItem This generic method is called at the end of each update*Item method. Its only purpose is being reimplemented in a subclass. The default implementation does nothing. More...
 
virtual QTreeWidgetItem * fillItem (QTreeWidgetItem *, PanelOptions=AddAllChild, bool=false)
 GenericPanel::fillItem This generic method is called at the end of each fill*Item method. Its only purpose is being reimplemented in a subclass. The default implementation does nothing. More...
 
virtual QString defaultText (QET::ItemType)
 GenericPanel::defaultText. More...
 
virtual QIcon defaultIcon (QET::ItemType)
 GenericPanel::defaultIcon. More...
 
virtual QTreeWidgetItem * makeItem (QET::ItemType, QTreeWidgetItem *=nullptr, const QString &=QString(), const QIcon &=QIcon())
 GenericPanel::makeItem Create a QTreeWidgetItem. More...
 
virtual void deleteItem (QTreeWidgetItem *, bool=false)
 GenericPanel::deleteItem Delete and item and its children. More...
 
virtual void markItemAsUnused (QTreeWidgetItem *)
 GenericPanel::markItemAsUnused Mark the provided QTreeWidgetItem as unused in its parent project. More...
 
virtual void reparent (QTreeWidgetItem *, QTreeWidgetItem *)
 GenericPanel::reparent. More...
 
QList< QTreeWidgetItem * > childItems (QTreeWidgetItem *, QET::ItemType, bool=false) const
 GenericPanel::childItems. More...
 
template<typename T >
void removeObsoleteItems (const QList< T > &, QTreeWidgetItem *, QET::ItemType, bool)
 
template<typename T >
valueForItem (QTreeWidgetItem *) const
 
void unregisterItem (QTreeWidgetItem *)
 GenericPanel::unregisterItem. More...
 
bool event (QEvent *) override
 GenericPanel::event Handle various events; reimplemented here to emit the signal firstActivated(). More...
 

Private Member Functions

 ElementsPanel (const ElementsPanel &)
 
QTreeWidgetItem * addProject (QETProject *, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild) override
 ElementsPanel::addProject Methode permettant d'ajouter un projet au panel d'elements. More...
 
QTreeWidgetItem * updateTemplatesCollectionItem (QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions=AddAllChild, bool=false) override
 GenericPanel::updateTemplatesCollectionItem. More...
 
QTreeWidgetItem * updateTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions, bool=false) override
 GenericPanel::updateTemplateItem. More...
 

Private Attributes

QSet< QETProject * > projects_to_display_
 list of projects that have been added to this panel More...
 
QTreeWidgetItem * common_tbt_collection_item_
 pointer to the item representing the common templates collection More...
 
QTreeWidgetItem * custom_tbt_collection_item_
 pointer to the item representing the user templates collection More...
 
bool first_reload_
 used to distinguish the first time this panel is reloaded More...
 
QString filter_
 Currently applied filter. More...
 
QStringList filter_list_
 Currently applied list of filter. More...
 

Additional Inherited Members

- Public Types inherited from GenericPanel
enum  PanelOption {
  AddChildDiagrams = 1, AddChildTemplatesCollection = 2, AddChildTemplates = 4, AddAllChildTemplates = 6,
  AddAllChild = 63, All = 127
}
 
enum  MetaData { Item = Qt::UserRole + 1, AliasItem, Parent, PanelFlags }
 

Detailed Description

This class provides a tree widget listing known filesystem-based elements collections and opened project files along with their content (diagrams, embedded collections, ...). It enables users to perform various actions on the displayed content

Constructor & Destructor Documentation

◆ ElementsPanel() [1/2]

ElementsPanel::ElementsPanel ( QWidget *  parent = nullptr)

Constructeur

Parameters
parentLe QWidget parent du panel d'appareils
Here is the call graph for this function:

◆ ~ElementsPanel()

ElementsPanel::~ElementsPanel ( )
override

Destructeur

◆ ElementsPanel() [2/2]

ElementsPanel::ElementsPanel ( const ElementsPanel )
private

Member Function Documentation

◆ addProject()

QTreeWidgetItem * ElementsPanel::addProject ( QETProject project,
QTreeWidgetItem *  parent_item = nullptr,
PanelOptions  options = AddAllChild 
)
overrideprivatevirtual

ElementsPanel::addProject Methode permettant d'ajouter un projet au panel d'elements.

Parameters
project: project Projet a inserer dans le panel d'elements
parent_item: Q_UNUSED QTreeWidgetItem parent sous lequel sera insere le projet
options: Q_UNUSED
Returns
Le QTreeWidgetItem insere le plus haut

Reimplemented from GenericPanel.

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

◆ applyCurrentFilter

void ElementsPanel::applyCurrentFilter ( const QList< QTreeWidgetItem * > &  items)
slot

Apply the current filter to a given item.

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

◆ buildFilterList

void ElementsPanel::buildFilterList ( )
slot

Build filter list for multiple filter

Here is the caller graph for this function:

◆ dirPathForItem()

QString ElementsPanel::dirPathForItem ( QTreeWidgetItem *  item)

ElementsPanel::dirPathForItem.

Parameters
item: a QTreeWidgetItem
Returns
the directory path of the object represented by item
Here is the call graph for this function:

◆ ensureHierarchyIsVisible

void ElementsPanel::ensureHierarchyIsVisible ( const QList< QTreeWidgetItem * > &  items)
slot
Parameters
itemsune liste de QTreeWidgetItem pour lesquels il faut s'assurer que eux et leurs parents sont visibles
Here is the caller graph for this function:

◆ filePathForItem()

QString ElementsPanel::filePathForItem ( QTreeWidgetItem *  item)

ElementsPanel::filePathForItem.

Parameters
item: a QTreeWidgetItem
Returns
the filepath of the object represented by item
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filter

void ElementsPanel::filter ( const QString &  m,
QET::Filtering  filtering = QET::RegularFilter 
)
slot

Hide items that do not match the provided string, ensure others are visible along with their parent hierarchy. When ending the filtering, restore the tree as it was before the filtering (except the current item) and scroll to the currently selected item.

Parameters
mString to be matched
filteringwhether to begin/apply/end the filtering
See also
QET::Filtering
Here is the call graph for this function:
Here is the caller graph for this function:

◆ matchesFilter()

bool ElementsPanel::matchesFilter ( const QTreeWidgetItem *  item,
const QString &  filter 
) const
protected
Returns
true if item matches the filter, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ panelContentChange

void ElementsPanel::panelContentChange ( )
protectedslot

Ensure the filter is applied again after the panel content has changed.

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

◆ projectWasClosed

void ElementsPanel::projectWasClosed ( QETProject project)
slot

Enleve un projet du panel d'elements

Parameters
projectProjet a enlever du panel
Here is the call graph for this function:

◆ projectWasOpened

void ElementsPanel::projectWasOpened ( QETProject project)
slot

Rajoute un projet au panel d'elements

Parameters
projectProjet ouvert a rajouter au panel
Here is the call graph for this function:

◆ reload

void ElementsPanel::reload ( bool  reload_collections = false)
slot

ElementsPanel::reload Reload the elements tree.

Parameters
reload_collections: true for read all collections since their sources (files, projects ...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestForDiagram

void ElementsPanel::requestForDiagram ( Diagram )
signal
Here is the caller graph for this function:

◆ requestForProject

void ElementsPanel::requestForProject ( QETProject )
signal
Here is the caller graph for this function:

◆ requestForTitleBlockTemplate

void ElementsPanel::requestForTitleBlockTemplate ( const TitleBlockTemplateLocation )
signal
Here is the caller graph for this function:

◆ slot_doubleClick

void ElementsPanel::slot_doubleClick ( QTreeWidgetItem *  qtwi,
int   
)
slot

Gere le double-clic sur un element. Si un double-clic sur un projet est effectue, le signal requestForProject est emis. Si un double-clic sur un schema est effectue, le signal requestForDiagram est emis.

Parameters
qtwi
Here is the caller graph for this function:

◆ startDrag()

void ElementsPanel::startDrag ( Qt::DropActions  supportedActions)
overrideprotected

Gere le debut des drag'n drop

Parameters
supportedActionsLes actions supportees
Here is the call graph for this function:

◆ startTitleBlockTemplateDrag()

void ElementsPanel::startTitleBlockTemplateDrag ( const TitleBlockTemplateLocation location)
protected

Handle the dragging of a title block template

Parameters
locationLocation of the dragged template.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTemplateItem()

QTreeWidgetItem * ElementsPanel::updateTemplateItem ( QTreeWidgetItem *  tb_template_qtwi,
const TitleBlockTemplateLocation tb_template,
PanelOptions  options,
bool  freshly_created = false 
)
overrideprivatevirtual

GenericPanel::updateTemplateItem.

Parameters
tb_template_qtwi
tb_template
options
freshly_created
Returns
updateItem(tb_template_qtwi, options, freshly_created)

Reimplemented from GenericPanel.

Here is the call graph for this function:

◆ updateTemplatesCollectionItem()

QTreeWidgetItem * ElementsPanel::updateTemplatesCollectionItem ( QTreeWidgetItem *  tbt_collection_qtwi,
TitleBlockTemplatesCollection tbt_collection,
PanelOptions  options = AddAllChild,
bool  freshly_created = false 
)
overrideprivatevirtual

GenericPanel::updateTemplatesCollectionItem.

Parameters
tbt_collection_qtwi
tbt_collection
options
freshly_created
Returns
updateItem(tbt_collection_qtwi, options, freshly_created)

Reimplemented from GenericPanel.

Here is the call graph for this function:

Member Data Documentation

◆ common_tbt_collection_item_

QTreeWidgetItem* ElementsPanel::common_tbt_collection_item_
private

pointer to the item representing the common templates collection

◆ custom_tbt_collection_item_

QTreeWidgetItem* ElementsPanel::custom_tbt_collection_item_
private

pointer to the item representing the user templates collection

◆ filter_

QString ElementsPanel::filter_
private

Currently applied filter.

◆ filter_list_

QStringList ElementsPanel::filter_list_
private

Currently applied list of filter.

◆ first_reload_

bool ElementsPanel::first_reload_
private

used to distinguish the first time this panel is reloaded

◆ projects_to_display_

QSet<QETProject *> ElementsPanel::projects_to_display_
private

list of projects that have been added to this panel


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