QElectroTech  0.8-dev
masterpropertieswidget.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef MASTERPROPERTIESWIDGET_H
19 #define MASTERPROPERTIESWIDGET_H
20 
21 #include <QWidget>
22 #include <QHash>
24 
25 class Element;
26 class QUndoCommand;
27 class QETProject;
28 class Diagram;
29 class QTreeWidgetItem;
30 class QMenu;
31 class QAction;
32 
33 namespace Ui {
35 }
36 
44 {
45  Q_OBJECT
46 
47  public:
48  explicit MasterPropertiesWidget(Element *elmt,
49  QWidget *parent = nullptr);
50  ~MasterPropertiesWidget() override;
51 
52  void setElement (Element *element) override;
53  void apply() override;
54  void reset() override;
55  QUndoCommand *associatedUndo () const override;
60  QString title() const override {
61  return tr("Référence croisée (maître)");}
62  bool setLiveEdit(bool live_edit) override;
63 
64  public slots:
65  void updateUi() override;
66 
67  private slots:
68  void headerCustomContextMenuRequested(const QPoint &pos);
71  void showElementFromTWI(QTreeWidgetItem *qtwi, int column);
74  void customContextMenu(const QPoint &pos, int i=0);
75 
76  private:
77  Ui::MasterPropertiesWidget *ui;
78  QHash <QTreeWidgetItem *, Element *> m_qtwi_hash;
79  QTreeWidgetItem *m_qtwi_at_context_menu = nullptr;
80  QPointer <Element> m_showed_element;
83  QAction *m_link_action,
88 };
89 
90 #endif // MASTERPROPERTIESWIDGET_H
MasterPropertiesWidget::m_show_element
QAction * m_show_element
Definition: masterpropertieswidget.h:86
MasterPropertiesWidget::m_link_action
QAction * m_link_action
Definition: masterpropertieswidget.h:83
MasterPropertiesWidget::showElementFromTWI
void showElementFromTWI(QTreeWidgetItem *qtwi, int column)
MasterPropertiesWidget::showElementFromTWI Show the element corresponding to the given QTreeWidgetIte...
Definition: masterpropertieswidget.cpp:389
MasterPropertiesWidget::m_show_qtwi
QAction * m_show_qtwi
Definition: masterpropertieswidget.h:85
MasterPropertiesWidget::associatedUndo
QUndoCommand * associatedUndo() const override
MasterPropertiesWidget::associatedUndo If link between the edited element and other change,...
Definition: masterpropertieswidget.cpp:197
autonum::sequentialNumbers
Definition: assignvariables.h:35
PropertiesEditorWidget::m_live_edit
bool m_live_edit
Definition: propertieseditorwidget.h:50
MasterPropertiesWidget::headerCustomContextMenuRequested
void headerCustomContextMenuRequested(const QPoint &pos)
MasterPropertiesWidget::headerCustomContextMenuRequested.
Definition: masterpropertieswidget.cpp:338
ElementProvider
Definition: elementprovider.h:37
QetGraphicsItem::diagram
Diagram * diagram() const
Definition: qetgraphicsitem.cpp:40
MasterPropertiesWidget::m_qtwi_hash
QHash< QTreeWidgetItem *, Element * > m_qtwi_hash
Definition: masterpropertieswidget.h:78
MasterPropertiesWidget::setLiveEdit
bool setLiveEdit(bool live_edit) override
MasterPropertiesWidget::setLiveEdit.
Definition: masterpropertieswidget.cpp:234
masterpropertieswidget.h
MasterPropertiesWidget::setElement
void setElement(Element *element) override
MasterPropertiesWidget::setElement Set the element to be edited.
Definition: masterpropertieswidget.cpp:126
diagramposition.h
MasterPropertiesWidget::m_unlink_action
QAction * m_unlink_action
Definition: masterpropertieswidget.h:84
MasterPropertiesWidget::m_qtwi_at_context_menu
QTreeWidgetItem * m_qtwi_at_context_menu
Definition: masterpropertieswidget.h:79
MasterPropertiesWidget::m_project
QETProject * m_project
Definition: masterpropertieswidget.h:81
MasterPropertiesWidget
The MasterPropertiesWidget class This class is a widget for make link between a master element with s...
Definition: masterpropertieswidget.h:44
Element::linkedElementChanged
void linkedElementChanged()
abstractelementpropertieseditorwidget.h
Element::Slave
@ Slave
Definition: element.h:56
MasterPropertiesWidget::showedElementWasDeleted
void showedElementWasDeleted()
MasterPropertiesWidget::showedElementWasDeleted Set to nullptr the current showed element when he was...
Definition: masterpropertieswidget.cpp:412
Diagram::project
QETProject * project() const
Diagram::project.
Definition: diagram.cpp:2326
MasterPropertiesWidget::customContextMenu
void customContextMenu(const QPoint &pos, int i=0)
MasterPropertiesWidget::customContextMenu Display a context menu.
Definition: masterpropertieswidget.cpp:436
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
elementprovider.h
MasterPropertiesWidget::title
QString title() const override
title
Definition: masterpropertieswidget.h:60
MasterPropertiesWidget::updateUi
void updateUi() override
MasterPropertiesWidget::updateUi Build the interface of the widget.
Definition: masterpropertieswidget.cpp:244
AbstractElementPropertiesEditorWidget
The AbstractElementPropertiesEditorWidget class This class provide common method for all widget used ...
Definition: abstractelementpropertieseditorwidget.h:31
element.h
MasterPropertiesWidget::m_context_menu
QMenu * m_context_menu
Definition: masterpropertieswidget.h:82
MasterPropertiesWidget::on_unlink_button_clicked
void on_unlink_button_clicked()
MasterPropertiesWidget::on_unlink_button_clicked move curent item in linked_list to free_list.
Definition: masterpropertieswidget.cpp:368
ElementProvider::freeElement
QList< Element * > freeElement(const int filter) const
ElementProvider::FreeElement Search and return the asked element corresponding with the given filter ...
Definition: elementprovider.cpp:54
Element
Definition: element.h:41
autonum::AssignVariables::formulaToLabel
static QString formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt=nullptr)
AssignVariables::formulaToLabel Return the formula with variable assigned (ready to be displayed)
Definition: assignvariables.cpp:187
linkelementcommand.h
MasterPropertiesWidget::on_link_button_clicked
void on_link_button_clicked()
MasterPropertiesWidget::on_link_button_clicked move curent item in the free_list to linked_list.
Definition: masterpropertieswidget.cpp:349
Ui
Definition: autonumberingdockwidget.h:25
QETProject
Definition: qetproject.h:51
MasterPropertiesWidget::diagramWasdeletedFromProject
void diagramWasdeletedFromProject()
MasterPropertiesWidget::diagramWasdeletedFromProject This slot is called when a diagram is removed fr...
Definition: masterpropertieswidget.cpp:421
MasterPropertiesWidget::reset
void reset() override
MasterPropertiesWidget::reset Reset curent widget, clear eveything and rebuild widget.
Definition: masterpropertieswidget.cpp:181
MasterPropertiesWidget::MasterPropertiesWidget
MasterPropertiesWidget(Element *elmt, QWidget *parent=nullptr)
MasterPropertiesWidget::MasterPropertiesWidget Default constructor.
Definition: masterpropertieswidget.cpp:33
MasterPropertiesWidget::apply
void apply() override
MasterPropertiesWidget::apply If link betwen edited element and other change, apply the change with a...
Definition: masterpropertieswidget.cpp:172
MasterPropertiesWidget::~MasterPropertiesWidget
~MasterPropertiesWidget() override
MasterPropertiesWidget::~MasterPropertiesWidget Destructor.
Definition: masterpropertieswidget.cpp:110
MasterPropertiesWidget::ui
Ui::MasterPropertiesWidget * ui
Definition: masterpropertieswidget.h:77
MasterPropertiesWidget::m_save_header_state
QAction * m_save_header_state
Definition: masterpropertieswidget.h:87
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
diagram.h
MasterPropertiesWidget::m_showed_element
QPointer< Element > m_showed_element
Definition: masterpropertieswidget.h:80
AbstractElementPropertiesEditorWidget::m_element
QPointer< Element > m_element
Definition: abstractelementpropertieseditorwidget.h:38