QElectroTech  0.70
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>

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 *)
 
QString filePathForItem (QTreeWidgetItem *)
 
- Public Member Functions inherited from GenericPanel
 GenericPanel (QWidget *=nullptr)
 
 ~GenericPanel () override
 
virtual int currentItemType ()
 
virtual QETProjectprojectForItem (QTreeWidgetItem *) const
 
virtual DiagramdiagramForItem (QTreeWidgetItem *) const
 
virtual TitleBlockTemplateLocation templateLocationForItem (QTreeWidgetItem *) const
 
virtual QETProjectselectedProject () const
 
virtual DiagramselectedDiagram () const
 
virtual TitleBlockTemplateLocation selectedTemplateLocation () const
 
virtual QTreeWidgetItem * itemForProject (QETProject *)
 
virtual QTreeWidgetItem * addDiagram (Diagram *, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild)
 
virtual QTreeWidgetItem * addTemplatesCollection (TitleBlockTemplatesCollection *, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild)
 
virtual QTreeWidgetItem * itemForTemplatesCollection (TitleBlockTemplatesCollection *)
 
virtual QTreeWidgetItem * addTemplate (const TitleBlockTemplateLocation &, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild)
 

Protected Slots

void panelContentChange ()
 
- Protected Slots inherited from GenericPanel
virtual void projectInformationsChanged (QETProject *)
 
virtual void diagramAdded (QETProject *, Diagram *)
 
virtual void diagramRemoved (QETProject *, Diagram *)
 
virtual void projectDiagramsOrderChanged (QETProject *, int, int)
 GenericPanel::projectDiagramsOrderChanged. More...
 
virtual void diagramTitleChanged (Diagram *, const QString &)
 
virtual void templatesCollectionChanged (TitleBlockTemplatesCollection *, const QString &)
 
virtual void diagramUsedTemplate (TitleBlockTemplatesCollection *, const QString &)
 

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)
 
virtual QTreeWidgetItem * fillProjectItem (QTreeWidgetItem *, QETProject *, PanelOptions=AddAllChild, bool=false)
 
virtual QTreeWidgetItem * getItemForDiagram (Diagram *, bool *=nullptr)
 
virtual QTreeWidgetItem * updateDiagramItem (QTreeWidgetItem *, Diagram *, PanelOptions=AddAllChild, bool=false)
 
virtual QTreeWidgetItem * fillDiagramItem (QTreeWidgetItem *, Diagram *, PanelOptions=AddAllChild, bool=false)
 
virtual QTreeWidgetItem * getItemForTemplatesCollection (TitleBlockTemplatesCollection *, bool *=nullptr)
 
virtual QTreeWidgetItem * fillTemplatesCollectionItem (QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions=AddAllChild, bool=false)
 
virtual QTreeWidgetItem * getItemForTemplate (const TitleBlockTemplateLocation &, bool *=nullptr)
 
virtual QTreeWidgetItem * fillTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions=AddAllChild, bool=false)
 
virtual QTreeWidgetItem * updateItem (QTreeWidgetItem *, PanelOptions=AddAllChild, bool=false)
 
virtual QTreeWidgetItem * fillItem (QTreeWidgetItem *, PanelOptions=AddAllChild, bool=false)
 
virtual QString defaultText (QET::ItemType)
 
virtual QIcon defaultIcon (QET::ItemType)
 
virtual QTreeWidgetItem * makeItem (QET::ItemType, QTreeWidgetItem *=nullptr, const QString &=QString(), const QIcon &=QIcon())
 
virtual void deleteItem (QTreeWidgetItem *, bool=false)
 
virtual void markItemAsUnused (QTreeWidgetItem *)
 
virtual void reparent (QTreeWidgetItem *, QTreeWidgetItem *)
 
QList< QTreeWidgetItem * > childItems (QTreeWidgetItem *, QET::ItemType, bool=false) const
 
template<typename T >
void removeObsoleteItems (const QList< T > &, QTreeWidgetItem *, QET::ItemType, bool)
 
template<typename T >
valueForItem (QTreeWidgetItem *) const
 
void unregisterItem (QTreeWidgetItem *)
 
bool event (QEvent *) override
 

Private Member Functions

 ElementsPanel (const ElementsPanel &)
 
QTreeWidgetItem * addProject (QETProject *, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild) override
 
QTreeWidgetItem * updateTemplatesCollectionItem (QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions=AddAllChild, bool=false) override
 
QTreeWidgetItem * updateTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions, bool=false) override
 

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

Definition at line 34 of file elementspanel.h.

Constructor & Destructor Documentation

◆ ElementsPanel() [1/2]

ElementsPanel::ElementsPanel ( QWidget *  parent = nullptr)

Constructeur

Parameters
parentLe QWidget parent du panel d'appareils

Definition at line 39 of file elementspanel.cpp.

References GenericPanel::firstActivated(), panelContentChange(), GenericPanel::panelContentChanged(), reload(), and slot_doubleClick().

◆ ~ElementsPanel()

ElementsPanel::~ElementsPanel ( )
override

Destructeur

Definition at line 77 of file elementspanel.cpp.

◆ 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

Methode permettant d'ajouter un projet au panel d'elements.

Parameters
qtwi_parentQTreeWidgetItem parent sous lequel sera insere le projet
projectProjet a inserer dans le panel d'elements
Returns
Le QTreeWidgetItem insere le plus haut

Reimplemented from GenericPanel.

Definition at line 126 of file elementspanel.cpp.

References GenericPanel::addProject(), GenericPanel::All, common_tbt_collection_item_, first_reload_, GenericPanel::itemForTemplatesCollection(), projects_to_display_, and QET::Icons::tr.

Referenced by projectWasOpened(), and reload().

◆ applyCurrentFilter

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

Apply the current filter to a given item.

Definition at line 365 of file elementspanel.cpp.

References buildFilterList(), ensureHierarchyIsVisible(), filter(), filter_, filter_list_, and matchesFilter().

Referenced by filter().

◆ buildFilterList

void ElementsPanel::buildFilterList ( )
slot

Build filter list for multiple filter

Definition at line 350 of file elementspanel.cpp.

References filter_, and filter_list_.

Referenced by applyCurrentFilter().

◆ dirPathForItem()

QString ElementsPanel::dirPathForItem ( QTreeWidgetItem *  item)
Parameters
qtwia QTreeWidgetItem
Returns
the directory path of the object represented by qtwi

Definition at line 250 of file elementspanel.cpp.

References filePathForItem().

◆ 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

Definition at line 389 of file elementspanel.cpp.

Referenced by applyCurrentFilter(), and filter().

◆ filePathForItem()

QString ElementsPanel::filePathForItem ( QTreeWidgetItem *  item)
Parameters
qtwia QTreeWidgetItem
Returns
the filepath of the object represented by qtwi

Definition at line 268 of file elementspanel.cpp.

References TitleBlockTemplateLocation::parentCollection(), GenericPanel::projectForItem(), and GenericPanel::templateLocationForItem().

Referenced by dirPathForItem().

◆ 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

Definition at line 294 of file elementspanel.cpp.

References applyCurrentFilter(), QET::BeginFilter, QET::EndFilter, ensureHierarchyIsVisible(), and filter_.

Referenced by applyCurrentFilter(), matchesFilter(), and panelContentChange().

◆ matchesFilter()

bool ElementsPanel::matchesFilter ( const QTreeWidgetItem *  item,
const QString &  filter 
) const
protected
Returns
true if item matches the filter, false otherwise

Definition at line 177 of file elementspanel.cpp.

References filter().

Referenced by applyCurrentFilter().

◆ panelContentChange

void ElementsPanel::panelContentChange ( )
protectedslot

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

Definition at line 114 of file elementspanel.cpp.

References filter(), and filter_.

Referenced by ElementsPanel().

◆ projectWasClosed

void ElementsPanel::projectWasClosed ( QETProject project)
slot

Enleve un projet du panel d'elements

Parameters
projectProjet a enlever du panel

Definition at line 339 of file elementspanel.cpp.

References GenericPanel::deleteItem(), GenericPanel::itemForProject(), GenericPanel::panelContentChanged(), and projects_to_display_.

◆ projectWasOpened

void ElementsPanel::projectWasOpened ( QETProject project)
slot

Rajoute un projet au panel d'elements

Parameters
projectProjet ouvert a rajouter au panel

Definition at line 329 of file elementspanel.cpp.

References addProject(), GenericPanel::panelContentChanged(), and projects_to_display_.

◆ reload

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

ElementsPanel::reload Reload the elements tree.

Parameters
reload_collectionstrue for read all collections since their sources (files, projects ...)

Definition at line 193 of file elementspanel.cpp.

References addProject(), GenericPanel::addTemplatesCollection(), common_tbt_collection_item_, QETApp::commonTitleBlockTemplatesCollection(), custom_tbt_collection_item_, QETApp::customTitleBlockTemplatesCollection(), first_reload_, projects_to_display_, and QET::Icons::tr.

Referenced by ElementsPanel().

◆ requestForDiagram

void ElementsPanel::requestForDiagram ( Diagram )
signal

Referenced by slot_doubleClick().

◆ requestForProject

void ElementsPanel::requestForProject ( QETProject )
signal

Referenced by slot_doubleClick().

◆ requestForTitleBlockTemplate

void ElementsPanel::requestForTitleBlockTemplate ( const TitleBlockTemplateLocation )
signal

Referenced by slot_doubleClick().

◆ 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

Definition at line 232 of file elementspanel.cpp.

References QET::Diagram, QET::Project, requestForDiagram(), requestForProject(), requestForTitleBlockTemplate(), and QET::TitleBlockTemplate.

Referenced by ElementsPanel().

◆ startDrag()

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

Gere le debut des drag'n drop

Parameters
supportedActionsLes actions supportees

Definition at line 84 of file elementspanel.cpp.

References TitleBlockTemplateLocation::isValid(), GenericPanel::selectedTemplateLocation(), and startTitleBlockTemplateDrag().

◆ startTitleBlockTemplateDrag()

void ElementsPanel::startTitleBlockTemplateDrag ( const TitleBlockTemplateLocation location)
protected

Handle the dragging of a title block template

Parameters
locationLocation of the dragged template.

Definition at line 98 of file elementspanel.cpp.

References QET::Icons::TitleBlock, and TitleBlockTemplateLocation::toString().

Referenced by startDrag().

◆ updateTemplateItem()

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

Reimplemented from GenericPanel.

Definition at line 162 of file elementspanel.cpp.

References QET::Icons::tr, and GenericPanel::updateTemplateItem().

◆ updateTemplatesCollectionItem()

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

Reimplemented from GenericPanel.

Definition at line 153 of file elementspanel.cpp.

References QET::Icons::tr, and GenericPanel::updateTemplatesCollectionItem().

Member Data Documentation

◆ common_tbt_collection_item_

QTreeWidgetItem* ElementsPanel::common_tbt_collection_item_
private

pointer to the item representing the common templates collection

Definition at line 84 of file elementspanel.h.

Referenced by addProject(), and reload().

◆ custom_tbt_collection_item_

QTreeWidgetItem* ElementsPanel::custom_tbt_collection_item_
private

pointer to the item representing the user templates collection

Definition at line 85 of file elementspanel.h.

Referenced by reload().

◆ filter_

QString ElementsPanel::filter_
private

Currently applied filter.

Definition at line 87 of file elementspanel.h.

Referenced by applyCurrentFilter(), buildFilterList(), filter(), and panelContentChange().

◆ filter_list_

QStringList ElementsPanel::filter_list_
private

Currently applied list of filter.

Definition at line 88 of file elementspanel.h.

Referenced by applyCurrentFilter(), and buildFilterList().

◆ first_reload_

bool ElementsPanel::first_reload_
private

used to distinguish the first time this panel is reloaded

Definition at line 86 of file elementspanel.h.

Referenced by addProject(), and reload().

◆ projects_to_display_

QSet<QETProject *> ElementsPanel::projects_to_display_
private

list of projects that have been added to this panel

Definition at line 83 of file elementspanel.h.

Referenced by addProject(), projectWasClosed(), projectWasOpened(), and reload().


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