QElectroTech 0.100.0-dev
|
The GenericPanel class 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. More...
#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 () |
Protected Slots | |
virtual void | projectInformationsChanged (QETProject *) |
GenericPanel::projectInformationsChanged. | |
virtual void | diagramAdded (QETProject *, Diagram *) |
GenericPanel::diagramAdded. | |
virtual void | diagramRemoved (QETProject *, Diagram *) |
GenericPanel::diagramRemoved. | |
virtual void | projectDiagramsOrderChanged (QETProject *, int, int) |
GenericPanel::projectDiagramsOrderChanged. | |
virtual void | diagramTitleChanged (Diagram *) |
GenericPanel::diagramTitleChanged Inform this panel the diagram diagram has changed its title to title. | |
virtual void | templatesCollectionChanged (TitleBlockTemplatesCollection *, const QString &) |
GenericPanel::templatesCollectionChanged. | |
virtual void | diagramUsedTemplate (TitleBlockTemplatesCollection *, const QString &) |
GenericPanel::diagramUsedTemplate. | |
Protected Member Functions | |
virtual QTreeWidgetItem * | getItemForProject (QETProject *, bool *=nullptr) |
virtual QTreeWidgetItem * | updateProjectItem (QTreeWidgetItem *, QETProject *, PanelOptions=AddAllChild, bool=false) |
GenericPanel::updateProjectItem. | |
virtual QTreeWidgetItem * | fillProjectItem (QTreeWidgetItem *, QETProject *, PanelOptions=AddAllChild, bool=false) |
GenericPanel::fillProjectItem. | |
virtual QTreeWidgetItem * | getItemForDiagram (Diagram *, bool *=nullptr) |
GenericPanel::getItemForDiagram. | |
virtual QTreeWidgetItem * | updateDiagramItem (QTreeWidgetItem *, Diagram *, PanelOptions=AddAllChild, bool=false) |
GenericPanel::updateDiagramItem. | |
virtual QTreeWidgetItem * | fillDiagramItem (QTreeWidgetItem *, PanelOptions=AddAllChild, bool=false) |
GenericPanel::fillDiagramItem. | |
virtual QTreeWidgetItem * | getItemForTemplatesCollection (TitleBlockTemplatesCollection *, bool *=nullptr) |
GenericPanel::getItemForTemplatesCollection. | |
virtual QTreeWidgetItem * | updateTemplatesCollectionItem (QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions=AddAllChild, bool=false) |
GenericPanel::updateTemplatesCollectionItem. | |
virtual QTreeWidgetItem * | fillTemplatesCollectionItem (QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions=AddAllChild, bool=false) |
GenericPanel::fillTemplatesCollectionItem. | |
virtual QTreeWidgetItem * | getItemForTemplate (const TitleBlockTemplateLocation &, bool *=nullptr) |
GenericPanel::getItemForTemplate. | |
virtual QTreeWidgetItem * | updateTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions=AddAllChild, bool=false) |
GenericPanel::updateTemplateItem. | |
virtual QTreeWidgetItem * | fillTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions=AddAllChild, bool=false) |
GenericPanel::fillTemplateItem. | |
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. | |
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. | |
virtual QString | defaultText (QET::ItemType) |
GenericPanel::defaultText. | |
virtual QIcon | defaultIcon (QET::ItemType) |
GenericPanel::defaultIcon. | |
virtual QTreeWidgetItem * | makeItem (QET::ItemType, QTreeWidgetItem *=nullptr, const QString &=QString(), const QIcon &=QIcon()) |
GenericPanel::makeItem Create a QTreeWidgetItem. | |
virtual void | deleteItem (QTreeWidgetItem *, bool=false) |
GenericPanel::deleteItem Delete and item and its children. | |
virtual void | markItemAsUnused (QTreeWidgetItem *) |
GenericPanel::markItemAsUnused Mark the provided QTreeWidgetItem as unused in its parent project. | |
virtual void | reparent (QTreeWidgetItem *, QTreeWidgetItem *) |
GenericPanel::reparent. | |
QList< QTreeWidgetItem * > | childItems (QTreeWidgetItem *, QET::ItemType, bool=false) const |
GenericPanel::childItems. | |
template<typename T > | |
void | removeObsoleteItems (const QList< T > &, QTreeWidgetItem *, QET::ItemType, bool) |
template<typename T > | |
T | valueForItem (QTreeWidgetItem *) const |
void | unregisterItem (QTreeWidgetItem *) |
GenericPanel::unregisterItem. | |
bool | event (QEvent *) override |
GenericPanel::event Handle various events; reimplemented here to emit the signal firstActivated(). | |
Private Slots | |
void | emitFirstActivated () |
GenericPanel::emitFirstActivated Emit the signal firstActivated(). | |
Private Attributes | |
bool | first_activation_ |
first_activation_ boolean used to track the first time this widget is activated/shown | |
QHash< QETProject *, QTreeWidgetItem * > | projects_ |
projects_ Allow quick retrieval of the item representing a given project | |
QHash< Diagram *, QTreeWidgetItem * > | diagrams_ |
diagrams_ Allow quick retrieval of the item representing a given diagram | |
QHash< TitleBlockTemplateLocation, QTreeWidgetItem * > | tb_templates_ |
tb_templates_ Allow quick retrieval of the item representing a title block template | |
The GenericPanel class 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.
GenericPanel::GenericPanel | ( | QWidget * | parent = nullptr | ) |
Constructor
parent | Parent QWidget |
|
override |
Destructor
|
virtual |
diagram | |
parent_item | |
options | (unused) |
|
virtual |
project | |
parent_item | |
options |
Reimplemented in ElementsPanel.
|
virtual |
tb_template | |
parent_item | |
options |
|
virtual |
GenericPanel::addTemplatesCollection.
tbt_collection | |
parent_item | |
options |
|
protected |
item | Parent item that will be searched. |
type | Type of items to look for. |
recursive | Whether to search recursively. |
|
virtual |
|
protectedvirtual |
type | Item type we want the default icon for |
|
protectedvirtual |
type |
|
protectedvirtual |
GenericPanel::deleteItem 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. (unused) |
|
protectedvirtualslot |
project | |
diagram | (unused) |
|
virtual |
item |
|
protectedvirtualslot |
project | |
diagram | (unused) |
|
protectedvirtualslot |
GenericPanel::diagramTitleChanged Inform this panel the diagram diagram has changed its title to title.
diagram |
|
protectedvirtualslot |
GenericPanel::diagramUsedTemplate.
collection | |
name | : (unused) |
|
privateslot |
GenericPanel::emitFirstActivated Emit the signal firstActivated().
|
overrideprotected |
GenericPanel::event Handle various events; reimplemented here to emit the signal firstActivated().
event |
|
protectedvirtual |
GenericPanel::fillDiagramItem.
diagram_qtwi | |
options | |
freshly_created |
|
protectedvirtual |
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.
qtwi | |
options | (unused) |
freshly_created | (unused) |
|
protectedvirtual |
GenericPanel::fillProjectItem.
project_qtwi | |
project | |
options | |
freshly_created |
|
protectedvirtual |
GenericPanel::fillTemplateItem.
tb_template_qtwi | |
tb_template | (unused) |
options | |
freshly_created |
|
protectedvirtual |
GenericPanel::fillTemplatesCollectionItem.
tbt_collection_qtwi | |
tbt_collection | |
options | |
freshly_created |
|
signal |
|
protectedvirtual |
GenericPanel::getItemForDiagram.
diagram | |
created |
|
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. |
|
protectedvirtual |
GenericPanel::getItemForTemplate.
tb_template | |
created |
|
protectedvirtual |
GenericPanel::getItemForTemplatesCollection.
tbt_collection | |
created |
|
virtual |
project | A standard project. |
|
virtual |
GenericPanel::itemForTemplatesCollection.
tbt_collection |
|
protectedvirtual |
GenericPanel::makeItem Create a QTreeWidgetItem.
type | Item type (e.g QET::Diagram, QET::Project, ...) |
parent | Parent for the created item |
label | Label for the created item |
icon | Icon for the created item |
|
protectedvirtual |
GenericPanel::markItemAsUnused Mark the provided QTreeWidgetItem as unused in its parent project.
qtwi | A QTreeWidgetItem |
|
signal |
|
protectedvirtualslot |
GenericPanel::projectDiagramsOrderChanged.
project | project where diagram moved |
from | Index of diagram before move |
to | Index of diagram after move |
|
virtual |
item |
|
protectedvirtualslot |
GenericPanel::projectInformationsChanged.
project |
|
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. |
|
protectedvirtual |
|
virtual |
GenericPanel::selectedDiagram.
|
virtual |
GenericPanel::selectedProject.
|
virtual |
GenericPanel::selectedTemplateLocation.
|
virtual |
GenericPanel::templateLocationForItem.
item |
|
protectedvirtualslot |
GenericPanel::templatesCollectionChanged.
collection | : Title block templates collection that changed and should be updated |
template_name | : Name of the changed template (unused) |
|
protected |
|
protectedvirtual |
GenericPanel::updateDiagramItem.
diagram_qtwi | |
diagram | |
options | |
freshly_created |
|
protectedvirtual |
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.
qtwi | |
options | (unused) |
freshly_created | (unused) |
|
protectedvirtual |
GenericPanel::updateProjectItem.
project_qtwi | |
project | |
options | (unused) |
freshly_created |
|
protectedvirtual |
GenericPanel::updateTemplateItem.
tb_template_qtwi | |
tb_template | |
options | |
freshly_created |
Reimplemented in ElementsPanel.
|
protectedvirtual |
GenericPanel::updateTemplatesCollectionItem.
tbt_collection_qtwi | |
tbt_collection | |
options | |
freshly_created |
Reimplemented in ElementsPanel.
|
protected |
|
private |
diagrams_ Allow quick retrieval of the item representing a given diagram
|
private |
first_activation_ boolean used to track the first time this widget is activated/shown
|
private |
projects_ Allow quick retrieval of the item representing a given project
|
private |
tb_templates_ Allow quick retrieval of the item representing a title block template