QElectroTech  0.70
Public Slots | Public Member Functions | Private Slots | Private Attributes | List of all members
MasterPropertiesWidget Class Reference

The MasterPropertiesWidget class This class is a widget for make link between a master element with several slave element. This class embenddedthe undo/redo command when apply new connection. More...

#include <masterpropertieswidget.h>

Public Slots

void updateUi () override
 MasterPropertiesWidget::updateUi Build the interface of the widget. More...
 

Public Member Functions

 MasterPropertiesWidget (Element *elmt, QWidget *parent=nullptr)
 MasterPropertiesWidget::MasterPropertiesWidget Default constructor. More...
 
 ~MasterPropertiesWidget () override
 MasterPropertiesWidget::~MasterPropertiesWidget Destructor. More...
 
void setElement (Element *element) override
 MasterPropertiesWidget::setElement Set the element to be edited. More...
 
void apply () override
 MasterPropertiesWidget::apply If link betwen edited element and other change, apply the change with a QUndoCommand (got with method associatedUndo) pushed to the stack of element project. Return true if link change, else false. More...
 
void reset () override
 MasterPropertiesWidget::reset Reset curent widget, clear eveything and rebuild widget. More...
 
QUndoCommand * associatedUndo () const override
 MasterPropertiesWidget::associatedUndo If link between the edited element and other change, return a QUndoCommand with this change. If no change return nullptr. More...
 
QString title () const override
 PropertiesEditorWidget::title. More...
 
bool setLiveEdit (bool live_edit) override
 MasterPropertiesWidget::setLiveEdit. More...
 
- Public Member Functions inherited from AbstractElementPropertiesEditorWidget
 AbstractElementPropertiesEditorWidget (QWidget *parent=nullptr)
 
- Public Member Functions inherited from PropertiesEditorWidget
 PropertiesEditorWidget (QWidget *parent=nullptr)
 PropertiesEditorWidget::PropertiesEditorWidget Constructor. More...
 
virtual void updateUi ()
 
bool isLiveEdit () const
 PropertiesEditorWidget::isLiveEdit. More...
 

Private Slots

void headerCustomContextMenuRequested (const QPoint &pos)
 
void on_link_button_clicked ()
 MasterPropertiesWidget::on_link_button_clicked move curent item in the free_list to linked_list. More...
 
void on_unlink_button_clicked ()
 MasterPropertiesWidget::on_unlink_button_clicked move curent item in linked_list to free_list. More...
 
void showElementFromTWI (QTreeWidgetItem *qtwi, int column)
 MasterPropertiesWidget::showElementFromTWI Show the element corresponding to the given QTreeWidgetItem. More...
 
void showedElementWasDeleted ()
 MasterPropertiesWidget::showedElementWasDeleted Set to nullptr the current showed element when he was deleted. More...
 
void diagramWasdeletedFromProject ()
 MasterPropertiesWidget::diagramWasdeletedFromProject This slot is called when a diagram is removed from the parent project of edited element to update the content of this widget. More...
 
void customContextMenu (const QPoint &pos, int i=0)
 MasterPropertiesWidget::customContextMenu Display a context menu. More...
 

Private Attributes

Ui::MasterPropertiesWidget * ui
 
QHash< QTreeWidgetItem *, Element * > m_qtwi_hash
 
QTreeWidgetItem * m_qtwi_at_context_menu = nullptr
 
QPointer< Elementm_showed_element
 
QETProjectm_project
 
QMenu * m_context_menu
 
QAction * m_link_action
 
QAction * m_unlink_action
 
QAction * m_show_qtwi
 
QAction * m_show_element
 
QAction * m_save_header_state
 

Additional Inherited Members

- Protected Member Functions inherited from PropertiesEditorWidget
virtual void enableLiveEdit ()
 
virtual void disableLiveEdit ()
 
- Protected Attributes inherited from AbstractElementPropertiesEditorWidget
QPointer< Elementm_element
 
- Protected Attributes inherited from PropertiesEditorWidget
bool m_live_edit
 

Detailed Description

The MasterPropertiesWidget class This class is a widget for make link between a master element with several slave element. This class embenddedthe undo/redo command when apply new connection.

Definition at line 43 of file masterpropertieswidget.h.

Constructor & Destructor Documentation

◆ MasterPropertiesWidget()

MasterPropertiesWidget::MasterPropertiesWidget ( Element elmt,
QWidget *  parent = nullptr 
)
explicit

◆ ~MasterPropertiesWidget()

MasterPropertiesWidget::~MasterPropertiesWidget ( )
override

Member Function Documentation

◆ apply()

void MasterPropertiesWidget::apply ( )
overridevirtual

MasterPropertiesWidget::apply If link betwen edited element and other change, apply the change with a QUndoCommand (got with method associatedUndo) pushed to the stack of element project. Return true if link change, else false.

Reimplemented from PropertiesEditorWidget.

Definition at line 153 of file masterpropertieswidget.cpp.

References associatedUndo(), and AbstractElementPropertiesEditorWidget::m_element.

Referenced by on_link_button_clicked(), and on_unlink_button_clicked().

◆ associatedUndo()

QUndoCommand * MasterPropertiesWidget::associatedUndo ( ) const
overridevirtual

MasterPropertiesWidget::associatedUndo If link between the edited element and other change, return a QUndoCommand with this change. If no change return nullptr.

Returns

Reimplemented from PropertiesEditorWidget.

Definition at line 178 of file masterpropertieswidget.cpp.

References AbstractElementPropertiesEditorWidget::m_element, m_qtwi_hash, LinkElementCommand::setLink(), ui, and LinkElementCommand::unlinkAll().

Referenced by apply().

◆ customContextMenu

void MasterPropertiesWidget::customContextMenu ( const QPoint &  pos,
int  i = 0 
)
privateslot

MasterPropertiesWidget::customContextMenu Display a context menu.

Parameters
pos
i: the tree widget where the context menu was requested.

Definition at line 393 of file masterpropertieswidget.cpp.

References m_context_menu, m_link_action, m_qtwi_at_context_menu, m_show_element, m_show_qtwi, m_unlink_action, and ui.

◆ diagramWasdeletedFromProject

void MasterPropertiesWidget::diagramWasdeletedFromProject ( )
privateslot

MasterPropertiesWidget::diagramWasdeletedFromProject This slot is called when a diagram is removed from the parent project of edited element to update the content of this widget.

Definition at line 380 of file masterpropertieswidget.cpp.

References updateUi().

Referenced by setElement().

◆ headerCustomContextMenuRequested

void MasterPropertiesWidget::headerCustomContextMenuRequested ( const QPoint &  pos)
privateslot

Definition at line 301 of file masterpropertieswidget.cpp.

References m_context_menu, m_save_header_state, and ui.

Referenced by MasterPropertiesWidget().

◆ on_link_button_clicked

void MasterPropertiesWidget::on_link_button_clicked ( )
privateslot

MasterPropertiesWidget::on_link_button_clicked move curent item in the free_list to linked_list.

Definition at line 312 of file masterpropertieswidget.cpp.

References apply(), PropertiesEditorWidget::m_live_edit, and ui.

Referenced by MasterPropertiesWidget().

◆ on_unlink_button_clicked

void MasterPropertiesWidget::on_unlink_button_clicked ( )
privateslot

MasterPropertiesWidget::on_unlink_button_clicked move curent item in linked_list to free_list.

Definition at line 330 of file masterpropertieswidget.cpp.

References apply(), PropertiesEditorWidget::m_live_edit, and ui.

Referenced by MasterPropertiesWidget().

◆ reset()

void MasterPropertiesWidget::reset ( )
overridevirtual

MasterPropertiesWidget::reset Reset curent widget, clear eveything and rebuild widget.

Reimplemented from PropertiesEditorWidget.

Definition at line 162 of file masterpropertieswidget.cpp.

References m_qtwi_hash, and updateUi().

◆ setElement()

void MasterPropertiesWidget::setElement ( Element element)
overridevirtual

◆ setLiveEdit()

bool MasterPropertiesWidget::setLiveEdit ( bool  live_edit)
overridevirtual

MasterPropertiesWidget::setLiveEdit.

Parameters
live_edit= true : live edit is enable else false : live edit is disable.
Returns
always true because live edit is handled by this editor widget

Reimplemented from PropertiesEditorWidget.

Definition at line 215 of file masterpropertieswidget.cpp.

References PropertiesEditorWidget::m_live_edit.

◆ showedElementWasDeleted

void MasterPropertiesWidget::showedElementWasDeleted ( )
privateslot

MasterPropertiesWidget::showedElementWasDeleted Set to nullptr the current showed element when he was deleted.

Definition at line 371 of file masterpropertieswidget.cpp.

References m_showed_element.

Referenced by showElementFromTWI().

◆ showElementFromTWI

void MasterPropertiesWidget::showElementFromTWI ( QTreeWidgetItem *  qtwi,
int  column 
)
privateslot

MasterPropertiesWidget::showElementFromTWI Show the element corresponding to the given QTreeWidgetItem.

Parameters
qtwi
column

Definition at line 350 of file masterpropertieswidget.cpp.

References AbstractElementPropertiesEditorWidget::m_element, m_qtwi_hash, m_showed_element, and showedElementWasDeleted().

Referenced by MasterPropertiesWidget().

◆ title()

QString MasterPropertiesWidget::title ( ) const
inlineoverridevirtual

PropertiesEditorWidget::title.

Returns
the title of this editor

Reimplemented from PropertiesEditorWidget.

Definition at line 55 of file masterpropertieswidget.h.

References QET::Icons::tr.

◆ updateUi

void MasterPropertiesWidget::updateUi ( )
overrideslot

Member Data Documentation

◆ m_context_menu

QMenu* MasterPropertiesWidget::m_context_menu
private

◆ m_link_action

QAction* MasterPropertiesWidget::m_link_action
private

Definition at line 77 of file masterpropertieswidget.h.

Referenced by customContextMenu(), and MasterPropertiesWidget().

◆ m_project

QETProject* MasterPropertiesWidget::m_project
private

Definition at line 75 of file masterpropertieswidget.h.

Referenced by setElement(), and updateUi().

◆ m_qtwi_at_context_menu

QTreeWidgetItem* MasterPropertiesWidget::m_qtwi_at_context_menu = nullptr
private

Definition at line 73 of file masterpropertieswidget.h.

Referenced by customContextMenu(), and MasterPropertiesWidget().

◆ m_qtwi_hash

QHash<QTreeWidgetItem *, Element *> MasterPropertiesWidget::m_qtwi_hash
private

Definition at line 72 of file masterpropertieswidget.h.

Referenced by associatedUndo(), reset(), showElementFromTWI(), and updateUi().

◆ m_save_header_state

QAction * MasterPropertiesWidget::m_save_header_state
private

◆ m_show_element

QAction * MasterPropertiesWidget::m_show_element
private

Definition at line 77 of file masterpropertieswidget.h.

Referenced by customContextMenu(), and MasterPropertiesWidget().

◆ m_show_qtwi

QAction * MasterPropertiesWidget::m_show_qtwi
private

Definition at line 77 of file masterpropertieswidget.h.

Referenced by customContextMenu(), and MasterPropertiesWidget().

◆ m_showed_element

QPointer<Element> MasterPropertiesWidget::m_showed_element
private

◆ m_unlink_action

QAction * MasterPropertiesWidget::m_unlink_action
private

Definition at line 77 of file masterpropertieswidget.h.

Referenced by customContextMenu(), and MasterPropertiesWidget().

◆ ui

Ui::MasterPropertiesWidget* MasterPropertiesWidget::ui
private

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