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> 22 #include "abstractelementpropertieseditorwidget.h" 23 #include "diagramcontext.h" 24 25 class Element; 26 class QUndoCommand; 27 class ElementInfoPartWidget; 28 class ChangeElementInformationCommand; 29 30 namespace Ui { 31 class ElementInfoWidget; 32 } 33 34 /** 35 * @brief The ElementInfoWidget class 36 * this class is a widget to edit an element informations. 37 */ 38 class ElementInfoWidget : public AbstractElementPropertiesEditorWidget 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; title()50 QString title() const override {return tr("Informations");} 51 bool setLiveEdit(bool live_edit) override; 52 void updateUi() override; 53 DiagramContext currentInfo() const; 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; 73 bool m_first_activation; 74 }; 75 76 #endif // ELEMENTINFOWIDGET_H 77