QElectroTech  0.70
masterpropertieswidget.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 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, QWidget *parent = nullptr);
49  ~MasterPropertiesWidget() override;
50 
51  void setElement (Element *element) override;
52  void apply() override;
53  void reset() override;
54  QUndoCommand *associatedUndo () const override;
55  QString title() const override {return tr("Référence croisée (maître)");}
56  bool setLiveEdit(bool live_edit) override;
57 
58  public slots:
59  void updateUi() override;
60 
61  private slots:
62  void headerCustomContextMenuRequested(const QPoint &pos);
65  void showElementFromTWI(QTreeWidgetItem *qtwi, int column);
68  void customContextMenu(const QPoint &pos, int i=0);
69 
70  private:
71  Ui::MasterPropertiesWidget *ui;
72  QHash <QTreeWidgetItem *, Element *> m_qtwi_hash;
73  QTreeWidgetItem *m_qtwi_at_context_menu = nullptr;
74  QPointer <Element> m_showed_element;
77  QAction *m_link_action,
79  *m_show_qtwi,
82 };
83 
84 #endif // MASTERPROPERTIESWIDGET_H
void setElement(Element *element) override
MasterPropertiesWidget::setElement Set the element to be edited.
QUndoCommand * associatedUndo() const override
MasterPropertiesWidget::associatedUndo If link between the edited element and other change...
QPointer< Element > m_showed_element
MasterPropertiesWidget(Element *elmt, QWidget *parent=nullptr)
MasterPropertiesWidget::MasterPropertiesWidget Default constructor.
The MasterPropertiesWidget class This class is a widget for make link between a master element with s...
void reset() override
MasterPropertiesWidget::reset Reset curent widget, clear eveything and rebuild widget.
The AbstractElementPropertiesEditorWidget class This class provide common method for all widget used ...
void headerCustomContextMenuRequested(const QPoint &pos)
QHash< QTreeWidgetItem *, Element * > m_qtwi_hash
QIcon tr
Definition: qeticons.cpp:204
bool setLiveEdit(bool live_edit) override
MasterPropertiesWidget::setLiveEdit.
void apply() override
MasterPropertiesWidget::apply If link betwen edited element and other change, apply the change with a...
Ui::MasterPropertiesWidget * ui
~MasterPropertiesWidget() override
MasterPropertiesWidget::~MasterPropertiesWidget Destructor.
QString title() const override
PropertiesEditorWidget::title.
void showedElementWasDeleted()
MasterPropertiesWidget::showedElementWasDeleted Set to nullptr the current showed element when he was...
QTreeWidgetItem * m_qtwi_at_context_menu
void showElementFromTWI(QTreeWidgetItem *qtwi, int column)
MasterPropertiesWidget::showElementFromTWI Show the element corresponding to the given QTreeWidgetIte...
void on_link_button_clicked()
MasterPropertiesWidget::on_link_button_clicked move curent item in the free_list to linked_list...
void diagramWasdeletedFromProject()
MasterPropertiesWidget::diagramWasdeletedFromProject This slot is called when a diagram is removed fr...
void updateUi() override
MasterPropertiesWidget::updateUi Build the interface of the widget.
void customContextMenu(const QPoint &pos, int i=0)
MasterPropertiesWidget::customContextMenu Display a context menu.
void on_unlink_button_clicked()
MasterPropertiesWidget::on_unlink_button_clicked move curent item in linked_list to free_list...