QElectroTech  0.70
elementinfowidget.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 ELEMENTINFOWIDGET_H
19 #define ELEMENTINFOWIDGET_H
20 
21 #include <QWidget>
23 #include "diagramcontext.h"
24 
25 class Element;
26 class QUndoCommand;
29 
30 namespace Ui {
31  class ElementInfoWidget;
32 }
33 
39 {
40  Q_OBJECT
41 
42  //METHODS
43  public:
44  explicit ElementInfoWidget(Element *elmt, QWidget *parent = nullptr);
45  ~ElementInfoWidget() override;
46 
47  void setElement(Element *element) override;
48  void apply() override;
49  QUndoCommand *associatedUndo () const override;
50  QString title() const override {return tr("Informations");}
51  bool setLiveEdit(bool live_edit) override;
52  void updateUi() override;
54 
55 
56  protected:
57  bool event(QEvent *event) override;
58  void enableLiveEdit() override;
59  void disableLiveEdit() override;
60 
61  private:
62  void buildInterface();
63  ElementInfoPartWidget *infoPartWidgetForKey(const QString &key) const;
64 
65  private slots:
66  void firstActivated();
67  void elementInfoChange();
68 
69  //ATTRIBUTES
70  private:
71  Ui::ElementInfoWidget *ui;
72  QList <ElementInfoPartWidget *> m_eipw_list;
74 };
75 
76 #endif // ELEMENTINFOWIDGET_H
bool setLiveEdit(bool live_edit) override
ElementInfoWidget::setLiveEdit.
QString title() const override
PropertiesEditorWidget::title.
QUndoCommand * associatedUndo() const override
ElementInfoWidget::associatedUndo If the edited info is different of the actual element info...
DiagramContext currentInfo() const
ElementInfoWidget::currentInfo.
void firstActivated()
ElementInfoWidget::firstActivated Slot activated when this widget is show. Set the focus to the first...
Ui::ElementInfoWidget * ui
void updateUi() override
ElementInfoWidget::updateUi fill information fetch in m_element_info to the corresponding line edit...
~ElementInfoWidget() override
ElementInfoWidget::~ElementInfoWidget Destructor.
The AbstractElementPropertiesEditorWidget class This class provide common method for all widget used ...
The ChangeElementInformationCommand class This class manage undo/redo to change the element informati...
void elementInfoChange()
ElementInfoWidget::elementInfoChange This slot is called when m_element::elementInformation change...
void disableLiveEdit() override
ElementInfoWidget::disableLiveEdit disable the live edit mode.
QList< ElementInfoPartWidget * > m_eipw_list
void enableLiveEdit() override
ElementInfoWidget::enableLiveEdit Enable the live edit mode.
QIcon tr
Definition: qeticons.cpp:204
void setElement(Element *element) override
ElementInfoWidget::setElement Set to be the edited element.
ElementInfoWidget(Element *elmt, QWidget *parent=nullptr)
ElementInfoWidget::ElementInfoWidget Constructor.
void apply() override
ElementInfoWidget::apply Apply the new information with a new undo command (got with method associate...
bool event(QEvent *event) override
ElementInfoWidget::event Reimplemented from QWidget::event Only give focus to the first line edit at ...
void buildInterface()
ElementInfoWidget::buildInterface Build the widget.
ElementInfoPartWidget * infoPartWidgetForKey(const QString &key) const
ElementInfoWidget::infoPartWidgetForKey.
The ElementInfoWidget class this class is a widget to edit an element informations.