QElectroTech  0.8-dev
elementinfowidget.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 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
ElementInfoPartWidget::text
QString text() const
ElementInfoPartWidget::text.
Definition: elementinfopartwidget.cpp:63
ElementInfoWidget::currentInfo
DiagramContext currentInfo() const
ElementInfoWidget::currentInfo.
Definition: elementinfowidget.cpp:231
PropertiesEditorWidget::m_live_edit
bool m_live_edit
Definition: propertieseditorwidget.h:50
ElementInfoWidget::apply
void apply() override
ElementInfoWidget::apply Apply the new information with a new undo command (got with method associate...
Definition: elementinfowidget.cpp:91
ElementInfoWidget::infoPartWidgetForKey
ElementInfoPartWidget * infoPartWidgetForKey(const QString &key) const
ElementInfoWidget::infoPartWidgetForKey.
Definition: elementinfowidget.cpp:195
ElementInfoWidget::setLiveEdit
bool setLiveEdit(bool live_edit) override
ElementInfoWidget::setLiveEdit.
Definition: elementinfowidget.cpp:120
ElementInfoPartWidget::setEnabled
void setEnabled(bool e)
ElementInfoPartWidget::setEnabled enable the line edit.
Definition: elementinfopartwidget.cpp:105
DiagramContext::remove
void remove(const QString &key)
DiagramContext::remove.
Definition: diagramcontext.cpp:42
elementinfopartwidget.h
ElementInfoWidget::firstActivated
void firstActivated()
ElementInfoWidget::firstActivated Slot activated when this widget is show. Set the focus to the first...
Definition: elementinfowidget.cpp:257
QETApp::elementInfoKeys
static QStringList elementInfoKeys()
QETApp::elementInfoKeys.
Definition: qetapp.cpp:366
ElementInfoPartWidget
The ElementInfoPartWidget class gebruikt bij schema editor als men edit dit Element aanklikt.
Definition: elementinfopartwidget.h:33
ElementInfoWidget::ElementInfoWidget
ElementInfoWidget(Element *elmt, QWidget *parent=nullptr)
ElementInfoWidget::ElementInfoWidget Constructor.
Definition: elementinfowidget.cpp:32
changeelementinformationcommand.h
Element::elementInfoChange
void elementInfoChange(DiagramContext old_info, DiagramContext new_info)
abstractelementpropertieseditorwidget.h
ElementInfoWidget::updateUi
void updateUi() override
ElementInfoWidget::updateUi fill information fetch in m_element_info to the corresponding line edit.
Definition: elementinfowidget.cpp:211
ElementInfoWidget::setElement
void setElement(Element *element) override
ElementInfoWidget::setElement Set element to be the edited element.
Definition: elementinfowidget.cpp:57
ElementInfoPartWidget::setDisabled
void setDisabled(bool d)
ElementInfoPartWidget::setDisabled disable the line edit.
Definition: elementinfopartwidget.cpp:115
qetapp.h
QETApp::elementTranslatedInfoKey
static QString elementTranslatedInfoKey(const QString &)
ElementsProperties::translatedInfo Return the translated information key given by info If info don't ...
Definition: qetapp.cpp:400
ElementInfoWidget::~ElementInfoWidget
~ElementInfoWidget() override
ElementInfoWidget::~ElementInfoWidget Destructor.
Definition: elementinfowidget.cpp:46
ElementInfoPartWidget::key
QString key() const
Definition: elementinfopartwidget.h:43
AbstractElementPropertiesEditorWidget
The AbstractElementPropertiesEditorWidget class This class provide common method for all widget used ...
Definition: abstractelementpropertieseditorwidget.h:31
element.h
ElementInfoWidget::disableLiveEdit
void disableLiveEdit() override
ElementInfoWidget::disableLiveEdit disable the live edit mode.
Definition: elementinfowidget.cpp:168
ElementInfoWidget::m_eipw_list
QList< ElementInfoPartWidget * > m_eipw_list
Definition: elementinfowidget.h:72
Element
Definition: element.h:41
ElementInfoWidget::event
bool event(QEvent *event) override
ElementInfoWidget::event Reimplemented from QWidget::event Only give focus to the first line edit at ...
Definition: elementinfowidget.cpp:141
ElementInfoWidget::ui
Ui::ElementInfoWidget * ui
Definition: elementinfowidget.h:71
ElementInfoWidget::associatedUndo
QUndoCommand * associatedUndo() const override
ElementInfoWidget::associatedUndo If the edited info is different of the actual element info,...
Definition: elementinfowidget.cpp:104
ElementInfoWidget::m_first_activation
bool m_first_activation
Definition: elementinfowidget.h:73
ElementInfoPartWidget::textChanged
void textChanged(const QString &text)
Ui
Definition: autonumberingdockwidget.h:25
elementinfowidget.h
ElementInfoWidget::buildInterface
void buildInterface()
ElementInfoWidget::buildInterface Build the widget.
Definition: elementinfowidget.cpp:178
ElementInfoWidget::title
QString title() const override
PropertiesEditorWidget::title.
Definition: elementinfowidget.h:50
ChangeElementInformationCommand
The ChangeElementInformationCommand class This class manage undo/redo to change the element informati...
Definition: changeelementinformationcommand.h:31
ElementInfoWidget::elementInfoChange
void elementInfoChange()
ElementInfoWidget::elementInfoChange This slot is called when m_element::elementInformation change.
Definition: elementinfowidget.cpp:265
diagramcontext.h
DiagramContext::addValue
bool addValue(const QString &, const QVariant &, bool show=true)
Definition: diagramcontext.cpp:91
ElementInfoWidget
The ElementInfoWidget class this class is a widget to edit an element informations.
Definition: elementinfowidget.h:39
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
ElementInfoWidget::enableLiveEdit
void enableLiveEdit() override
ElementInfoWidget::enableLiveEdit Enable the live edit mode.
Definition: elementinfowidget.cpp:158
DiagramContext
Definition: diagramcontext.h:56
diagram.h
AbstractElementPropertiesEditorWidget::m_element
QPointer< Element > m_element
Definition: abstractelementpropertieseditorwidget.h:38