2014-02-12 17:36:35 +00:00
|
|
|
/*
|
2020-06-15 17:42:37 +02:00
|
|
|
Copyright 2006-2020 The QElectroTech Team
|
2014-02-12 17:36:35 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef ELEMENTINFOWIDGET_H
|
|
|
|
#define ELEMENTINFOWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2015-05-25 10:22:00 +00:00
|
|
|
#include "abstractelementpropertieseditorwidget.h"
|
2015-06-09 16:28:54 +00:00
|
|
|
#include "diagramcontext.h"
|
2014-12-11 20:10:28 +00:00
|
|
|
|
|
|
|
class Element;
|
|
|
|
class QUndoCommand;
|
|
|
|
class ElementInfoPartWidget;
|
|
|
|
class ChangeElementInformationCommand;
|
2014-02-12 17:36:35 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ElementInfoWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The ElementInfoWidget class
|
|
|
|
* this class is a widget to edit an element informations.
|
|
|
|
*/
|
2015-05-25 10:22:00 +00:00
|
|
|
class ElementInfoWidget : public AbstractElementPropertiesEditorWidget
|
2015-05-02 22:25:01 +00:00
|
|
|
{
|
2014-02-12 17:36:35 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
//METHODS
|
2014-12-11 20:10:28 +00:00
|
|
|
public:
|
2017-08-05 02:06:59 +00:00
|
|
|
explicit ElementInfoWidget(Element *elmt, QWidget *parent = nullptr);
|
2017-08-05 02:10:01 +00:00
|
|
|
~ElementInfoWidget() override;
|
2014-12-11 20:10:28 +00:00
|
|
|
|
2017-08-05 02:10:01 +00:00
|
|
|
void setElement(Element *element) override;
|
|
|
|
void apply() override;
|
|
|
|
QUndoCommand *associatedUndo () const override;
|
|
|
|
QString title() const override {return tr("Informations");}
|
|
|
|
bool setLiveEdit(bool live_edit) override;
|
|
|
|
void updateUi() override;
|
2015-06-09 16:28:54 +00:00
|
|
|
DiagramContext currentInfo() const;
|
|
|
|
|
2014-12-11 20:10:28 +00:00
|
|
|
|
2015-03-05 10:26:09 +00:00
|
|
|
protected:
|
2017-08-05 02:10:01 +00:00
|
|
|
bool event(QEvent *event) override;
|
|
|
|
void enableLiveEdit() override;
|
|
|
|
void disableLiveEdit() override;
|
2015-03-05 10:26:09 +00:00
|
|
|
|
2014-12-11 20:10:28 +00:00
|
|
|
private:
|
|
|
|
void buildInterface();
|
2016-11-24 16:45:55 +00:00
|
|
|
ElementInfoPartWidget *infoPartWidgetForKey(const QString &key) const;
|
2014-02-12 17:36:35 +00:00
|
|
|
|
2015-03-05 10:26:09 +00:00
|
|
|
private slots:
|
|
|
|
void firstActivated();
|
2015-06-09 16:28:54 +00:00
|
|
|
void elementInfoChange();
|
2015-03-05 10:26:09 +00:00
|
|
|
|
2014-02-12 17:36:35 +00:00
|
|
|
//ATTRIBUTES
|
2014-12-11 20:10:28 +00:00
|
|
|
private:
|
|
|
|
Ui::ElementInfoWidget *ui;
|
2015-05-31 15:02:41 +00:00
|
|
|
QList <ElementInfoPartWidget *> m_eipw_list;
|
2015-03-05 10:26:09 +00:00
|
|
|
bool m_first_activation;
|
2014-02-12 17:36:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ELEMENTINFOWIDGET_H
|