QElectroTech
0.70
|
#include <genericpanel.h>
Public Types | |
enum | PanelOption { AddChildDiagrams = 1, AddChildTemplatesCollection = 2, AddChildTemplates = 4, AddAllChildTemplates = 6, AddAllChild = 63, All = 127 } |
enum | MetaData { Item = Qt::UserRole + 1, AliasItem, Parent, PanelFlags } |
Signals | |
bool | firstActivated () |
void | panelContentChanged () |
Public Member Functions | |
GenericPanel (QWidget *=nullptr) | |
~GenericPanel () override | |
virtual int | currentItemType () |
virtual QETProject * | projectForItem (QTreeWidgetItem *) const |
virtual Diagram * | diagramForItem (QTreeWidgetItem *) const |
virtual TitleBlockTemplateLocation | templateLocationForItem (QTreeWidgetItem *) const |
virtual QETProject * | selectedProject () const |
virtual Diagram * | selectedDiagram () const |
virtual TitleBlockTemplateLocation | selectedTemplateLocation () const |
virtual QTreeWidgetItem * | addProject (QETProject *, QTreeWidgetItem *=nullptr, PanelOptions=AddAllChild) |
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 | |
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 | |
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 * | updateTemplatesCollectionItem (QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions=AddAllChild, bool=false) |
virtual QTreeWidgetItem * | fillTemplatesCollectionItem (QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions=AddAllChild, bool=false) |
virtual QTreeWidgetItem * | getItemForTemplate (const TitleBlockTemplateLocation &, bool *=nullptr) |
virtual QTreeWidgetItem * | updateTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions=AddAllChild, bool=false) |
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 > | |
T | valueForItem (QTreeWidgetItem *) const |
void | unregisterItem (QTreeWidgetItem *) |
bool | event (QEvent *) override |
Private Slots | |
void | emitFirstActivated () |
Private Attributes | |
bool | first_activation_ |
boolean used to track the first time this widget is activated/shown More... | |
QHash< QETProject *, QTreeWidgetItem * > | projects_ |
Allow quick retrieval of the item representing a given project. More... | |
QHash< Diagram *, QTreeWidgetItem * > | diagrams_ |
Allow quick retrieval of the item representing a given diagram. More... | |
QHash< TitleBlockTemplateLocation, QTreeWidgetItem * > | tb_templates_ |
Allow quick retrieval of the item representing a title block template. More... | |
The generic panel is a QTreeWidget subclass providing extra methods allowing developers to easily add objects (projects, diagrams, title block templates, elements, ...) to it; it also ensures the displayed information remains up to date.
Definition at line 35 of file genericpanel.h.
Enumerator | |
---|---|
Item | |
AliasItem | |
Parent | |
PanelFlags |
Definition at line 49 of file genericpanel.h.
Enumerator | |
---|---|
AddChildDiagrams | |
AddChildTemplatesCollection | |
AddChildTemplates | |
AddAllChildTemplates | |
AddAllChild | |
All |
Definition at line 39 of file genericpanel.h.
GenericPanel::GenericPanel | ( | QWidget * | parent = nullptr | ) |
Constructor
parent | Parent QWidget |
Definition at line 31 of file genericpanel.cpp.
References header.
|
override |
Destructor
Definition at line 42 of file genericpanel.cpp.
|
virtual |
Definition at line 240 of file genericpanel.cpp.
References fillDiagramItem(), getItemForDiagram(), reparent(), and updateDiagramItem().
Referenced by diagramTitleChanged(), and fillProjectItem().
|
virtual |
Reimplemented in ElementsPanel.
Definition at line 106 of file genericpanel.cpp.
References fillProjectItem(), getItemForProject(), reparent(), and updateProjectItem().
Referenced by ElementsPanel::addProject(), diagramAdded(), diagramRemoved(), and projectInformationsChanged().
|
virtual |
Definition at line 435 of file genericpanel.cpp.
References fillTemplateItem(), getItemForTemplate(), TitleBlockTemplateLocation::isValid(), reparent(), and updateTemplateItem().
Referenced by fillTemplatesCollectionItem().
|
virtual |
Definition at line 344 of file genericpanel.cpp.
References fillTemplatesCollectionItem(), getItemForTemplatesCollection(), reparent(), and updateTemplatesCollectionItem().
Referenced by diagramUsedTemplate(), fillProjectItem(), ElementsPanel::reload(), and templatesCollectionChanged().
|
protected |
item | Parent item that will be searched. |
type | Type of items to look for. |
recursive | Whether to search recursively. |
Definition at line 719 of file genericpanel.cpp.
Referenced by removeObsoleteItems().
|
virtual |
Definition at line 48 of file genericpanel.cpp.
|
protectedvirtual |
type | Item type we want the default icon for |
Definition at line 646 of file genericpanel.cpp.
References QET::Icons::Diagram, QET::Diagram, QET::ElementsContainer, QET::Icons::Folder, QET::Project, QET::Icons::ProjectFileGP, QET::Icons::TitleBlock, and QET::TitleBlockTemplatesCollectionItem.
Referenced by makeItem().
|
protectedvirtual |
Definition at line 625 of file genericpanel.cpp.
References QET::Diagram, QET::Element, QET::ElementsCategory, QET::ElementsCollection, QET::ElementsCollectionItem, QET::ElementsContainer, QET::Project, QET::TitleBlockTemplate, QET::TitleBlockTemplatesCollection, and QET::TitleBlockTemplatesCollectionItem.
Referenced by makeItem().
|
protectedvirtual |
Delete and item and its children.
item | item to delete |
deleted_on_cascade | true if the item is not being directly deleted but is undergoing the deletion of its parent. |
Definition at line 680 of file genericpanel.cpp.
References unregisterItem().
Referenced by ElementsPanel::projectWasClosed(), and removeObsoleteItems().
|
protectedvirtualslot |
Definition at line 540 of file genericpanel.cpp.
References AddChildDiagrams, addProject(), and panelContentChanged().
Referenced by fillProjectItem().
|
virtual |
Definition at line 65 of file genericpanel.cpp.
References QET::Diagram.
Referenced by selectedDiagram().
|
protectedvirtualslot |
Definition at line 549 of file genericpanel.cpp.
References AddChildDiagrams, addProject(), and panelContentChanged().
Referenced by fillProjectItem().
|
protectedvirtualslot |
Inform this panel the diagram diagram has changed its title to title.
Definition at line 596 of file genericpanel.cpp.
References addDiagram(), and panelContentChanged().
Referenced by updateDiagramItem().
|
protectedvirtualslot |
Definition at line 615 of file genericpanel.cpp.
References addTemplatesCollection(), and panelContentChanged().
Referenced by fillProjectItem(), and fillTemplatesCollectionItem().
|
privateslot |
Emit the signal firstActivated().
Definition at line 803 of file genericpanel.cpp.
References firstActivated().
Referenced by event().
|
overrideprotected |
Handle various events; reimplemented here to emit the signal firstActivated().
Definition at line 790 of file genericpanel.cpp.
References emitFirstActivated(), and first_activation_.
|
protectedvirtual |
|
protectedvirtual |
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.
Definition at line 522 of file genericpanel.cpp.
Referenced by fillDiagramItem(), fillProjectItem(), fillTemplateItem(), and fillTemplatesCollectionItem().
|
protectedvirtual |
Definition at line 190 of file genericpanel.cpp.
References AddChildDiagrams, AddChildTemplatesCollection, addDiagram(), addTemplatesCollection(), QET::Diagram, diagramAdded(), diagramRemoved(), diagramUsedTemplate(), fillItem(), projectDiagramsOrderChanged(), and removeObsoleteItems().
Referenced by addProject().
|
protectedvirtual |
Definition at line 497 of file genericpanel.cpp.
References fillItem().
Referenced by addTemplate().
|
protectedvirtual |
Definition at line 402 of file genericpanel.cpp.
References AddChildTemplates, addTemplate(), diagramUsedTemplate(), fillItem(), removeObsoleteItems(), templatesCollectionChanged(), and QET::TitleBlockTemplate.
Referenced by addTemplatesCollection().
|
signal |
Referenced by ElementsPanel::ElementsPanel(), and emitFirstActivated().
|
protectedvirtual |
Definition at line 257 of file genericpanel.cpp.
References QET::Diagram, diagrams_, and makeItem().
Referenced by addDiagram().
|
protectedvirtual |
project | A standard project. |
created | if provided with a pointer to a boolean, this method will update it to reflect whether the returned item has been freshly created or not. |
Definition at line 136 of file genericpanel.cpp.
References makeItem(), QET::Project, and projects_.
Referenced by addProject().
|
protectedvirtual |
Definition at line 450 of file genericpanel.cpp.
References TitleBlockTemplateLocation::isValid(), makeItem(), tb_templates_, and QET::TitleBlockTemplate.
Referenced by addTemplate().
|
protectedvirtual |
Definition at line 367 of file genericpanel.cpp.
References makeItem(), tb_templates_, and QET::TitleBlockTemplatesCollection.
Referenced by addTemplatesCollection().
|
virtual |
project | A standard project. |
Definition at line 123 of file genericpanel.cpp.
References projects_.
Referenced by projectDiagramsOrderChanged(), and ElementsPanel::projectWasClosed().
|
virtual |
Definition at line 359 of file genericpanel.cpp.
References tb_templates_.
Referenced by ElementsPanel::addProject().
|
protectedvirtual |
Create a QTreeWidgetItem
parent | Parent for the created item |
type | Item type (e.g QET::Diagram, QET::Project, ...) |
label | Label for the created item |
icon | Icon for the created item |
Definition at line 667 of file genericpanel.cpp.
References defaultIcon(), and defaultText().
Referenced by getItemForDiagram(), getItemForProject(), getItemForTemplate(), and getItemForTemplatesCollection().
|
protectedvirtual |
Mark the provided QTreeWidgetItem as unused in its parent project.
qtwi | A QTreeWidgetItem |
Definition at line 696 of file genericpanel.cpp.
References QET::Icons::tr.
Referenced by updateTemplateItem().
|
signal |
|
protectedvirtualslot |
GenericPanel::projectDiagramsOrderChanged.
project | project where diagram moved |
from | Index of diagram before move |
to | Index of diagram after move |
Definition at line 561 of file genericpanel.cpp.
References itemForProject(), panelContentChanged(), and updateDiagramItem().
Referenced by fillProjectItem().
|
virtual |
Definition at line 54 of file genericpanel.cpp.
References QET::Project.
Referenced by ElementsPanel::filePathForItem(), and selectedProject().
|
protectedvirtualslot |
Definition at line 532 of file genericpanel.cpp.
References addProject(), and panelContentChanged().
Referenced by updateProjectItem().
|
protected |
This variant of childItems() removes any child considered obsolete, i.e. not found in expected_items.
expected_items | A list of non-obsolete values |
item | Parent item that will be searched. |
type | Type of items to look for. |
recursive | Whether to search recursively. |
Definition at line 745 of file genericpanel.cpp.
References childItems(), and deleteItem().
Referenced by fillProjectItem(), and fillTemplatesCollectionItem().
|
protectedvirtual |
Definition at line 707 of file genericpanel.cpp.
Referenced by addDiagram(), addProject(), addTemplate(), and addTemplatesCollection().
|
virtual |
Definition at line 92 of file genericpanel.cpp.
References diagramForItem().
|
virtual |
Definition at line 85 of file genericpanel.cpp.
References projectForItem().
|
virtual |
Definition at line 99 of file genericpanel.cpp.
References templateLocationForItem().
Referenced by ElementsPanel::startDrag().
|
virtual |
Definition at line 75 of file genericpanel.cpp.
References QET::TitleBlockTemplatesCollectionItem.
Referenced by ElementsPanel::filePathForItem(), and selectedTemplateLocation().
|
protectedvirtualslot |
collection | Title block templates collection that changed and should be updated |
template_name | Name of the changed template (unused) |
Definition at line 606 of file genericpanel.cpp.
References addTemplatesCollection(), and panelContentChanged().
Referenced by fillTemplatesCollectionItem().
|
protected |
Definition at line 773 of file genericpanel.cpp.
References QET::Diagram, diagrams_, QET::Project, projects_, tb_templates_, and QET::TitleBlockTemplatesCollectionItem.
Referenced by deleteItem().
|
protectedvirtual |
Definition at line 274 of file genericpanel.cpp.
References Diagram::border_and_titleblock, diagrams_, diagramTitleChanged(), Diagram::diagramTitleChanged(), BorderTitleBlock::finalfolio(), Item, QET::Icons::tr, and updateItem().
Referenced by addDiagram(), and projectDiagramsOrderChanged().
|
protectedvirtual |
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.
Definition at line 509 of file genericpanel.cpp.
Referenced by updateDiagramItem(), updateProjectItem(), updateTemplateItem(), and updateTemplatesCollectionItem().
|
protectedvirtual |
Definition at line 153 of file genericpanel.cpp.
References Item, projectInformationsChanged(), projects_, QET::Icons::tr, and updateItem().
Referenced by addProject().
|
protectedvirtual |
Reimplemented in ElementsPanel.
Definition at line 467 of file genericpanel.cpp.
References Item, markItemAsUnused(), TitleBlockTemplateLocation::name(), TitleBlockTemplateLocation::parentProject(), tb_templates_, TitleBlockTemplateLocation::toString(), QET::Icons::tr, and updateItem().
Referenced by addTemplate(), and ElementsPanel::updateTemplateItem().
|
protectedvirtual |
Reimplemented in ElementsPanel.
Definition at line 383 of file genericpanel.cpp.
References Item, tb_templates_, QET::Icons::tr, and updateItem().
Referenced by addTemplatesCollection(), and ElementsPanel::updateTemplatesCollectionItem().
|
protected |
|
private |
Allow quick retrieval of the item representing a given diagram.
Definition at line 147 of file genericpanel.h.
Referenced by getItemForDiagram(), unregisterItem(), and updateDiagramItem().
|
private |
boolean used to track the first time this widget is activated/shown
Definition at line 145 of file genericpanel.h.
Referenced by event().
|
private |
Allow quick retrieval of the item representing a given project.
Definition at line 146 of file genericpanel.h.
Referenced by getItemForProject(), itemForProject(), unregisterItem(), and updateProjectItem().
|
private |
Allow quick retrieval of the item representing a title block template.
Definition at line 148 of file genericpanel.h.
Referenced by getItemForTemplate(), getItemForTemplatesCollection(), itemForTemplatesCollection(), unregisterItem(), updateTemplateItem(), and updateTemplatesCollectionItem().