QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
elementinfowidget.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 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 "../diagramcontext.h"
23
24#include <QWidget>
25
26class Element;
27class QUndoCommand;
31class QCheckBox;
32class QPushButton;
33
34namespace Ui {
35 class ElementInfoWidget;
36}
37
43{
44 Q_OBJECT
45
46 //METHODS
47 public:
48 explicit ElementInfoWidget(Element *elmt, QWidget *parent = nullptr);
49 ~ElementInfoWidget() override;
50
51 void setElement(Element *element) override;
52 void apply() override;
53 QUndoCommand *associatedUndo () const override;
54 QString title() const override {return tr("Informations");}
55 bool setLiveEdit(bool live_edit) override;
56 void updateUi() override;
58
59
60 protected:
61 bool event(QEvent *event) override;
62 void enableLiveEdit() override;
63 void disableLiveEdit() override;
64
65 private:
66 void buildInterface();
67 ElementInfoPartWidget *infoPartWidgetForKey(const QString &key) const;
68 QStringList predefinedKeys() const;
69
70 private slots:
71 void firstActivated();
72 void elementInfoChange();
73 void addCustomProperty(const QString &key = QString(), const QString &value = QString());
75
76 //ATTRIBUTES
77 private:
78 Ui::ElementInfoWidget *ui;
79 QList <ElementInfoPartWidget *> m_eipw_list;
80 QList <CustomElementInfoPartWidget *> m_custom_eipw_list;
81 QPushButton *m_add_custom_property_btn = nullptr;
82 QCheckBox *m_potential_isolating_cb = nullptr;
83 QCheckBox *m_exclude_from_bom_cb = nullptr;
85 bool m_ui_builded = false;
86};
87
88#endif // ELEMENTINFOWIDGET_H
AbstractElementPropertiesEditorWidget(QWidget *parent=nullptr)
Definition abstractelementpropertieseditorwidget.cpp:20
The ChangeElementInformationCommand class This class manage undo/redo to change the element informati...
Definition changeelementinformationcommand.h:32
The CustomElementInfoPartWidget class A single row letting the user define their own element informat...
Definition customelementinfopartwidget.h:34
Definition diagramcontext.h:92
Definition element.h:44
The ElementInfoPartWidget class gebruikt bij schema editor als men edit dit Element aanklikt.
Definition elementinfopartwidget.h:33
bool setLiveEdit(bool live_edit) override
ElementInfoWidget::setLiveEdit.
Definition elementinfowidget.cpp:124
DiagramContext currentInfo() const
ElementInfoWidget::currentInfo.
Definition elementinfowidget.cpp:392
bool event(QEvent *event) override
ElementInfoWidget::event Reimplemented from QWidget::event Only give focus to the first line edit at ...
Definition elementinfowidget.cpp:145
void disableLiveEdit() override
ElementInfoWidget::disableLiveEdit disable the live edit mode.
Definition elementinfowidget.cpp:180
void firstActivated()
ElementInfoWidget::firstActivated Slot activated when this widget is show. Set the focus to the first...
Definition elementinfowidget.cpp:439
void removeCustomProperty(CustomElementInfoPartWidget *widget)
ElementInfoWidget::removeCustomProperty Remove a user-defined key/value row.
Definition elementinfowidget.cpp:304
Ui::ElementInfoWidget * ui
Definition elementinfowidget.h:78
QCheckBox * m_exclude_from_bom_cb
Definition elementinfowidget.h:83
QList< ElementInfoPartWidget * > m_eipw_list
Definition elementinfowidget.h:79
ElementInfoWidget(Element *elmt, QWidget *parent=nullptr)
ElementInfoWidget::ElementInfoWidget Constructor.
Definition elementinfowidget.cpp:36
QUndoCommand * associatedUndo() const override
ElementInfoWidget::associatedUndo If the edited info is different of the actual element info,...
Definition elementinfowidget.cpp:108
QList< CustomElementInfoPartWidget * > m_custom_eipw_list
Definition elementinfowidget.h:80
void elementInfoChange()
ElementInfoWidget::elementInfoChange This slot is called when m_element::elementInformation change.
Definition elementinfowidget.cpp:448
void updateUi() override
ElementInfoWidget::updateUi fill information fetch in m_element_info to the corresponding line edit.
Definition elementinfowidget.cpp:337
bool m_ui_builded
Definition elementinfowidget.h:85
QCheckBox * m_potential_isolating_cb
Definition elementinfowidget.h:82
QPushButton * m_add_custom_property_btn
Definition elementinfowidget.h:81
QString title() const override
PropertiesEditorWidget::title.
Definition elementinfowidget.h:54
void setElement(Element *element) override
ElementInfoWidget::setElement Set element to be the edited element.
Definition elementinfowidget.cpp:61
void enableLiveEdit() override
ElementInfoWidget::enableLiveEdit Enable the live edit mode.
Definition elementinfowidget.cpp:162
void apply() override
ElementInfoWidget::apply Apply the new information with a new undo command (got with method associate...
Definition elementinfowidget.cpp:95
~ElementInfoWidget() override
ElementInfoWidget::~ElementInfoWidget Destructor.
Definition elementinfowidget.cpp:49
void buildInterface()
ElementInfoWidget::buildInterface Build the widget.
Definition elementinfowidget.cpp:198
bool m_first_activation
Definition elementinfowidget.h:84
void addCustomProperty(const QString &key=QString(), const QString &value=QString())
ElementInfoWidget::addCustomProperty Append a new user-defined key/value row to the widget.
Definition elementinfowidget.cpp:281
QStringList predefinedKeys() const
ElementInfoWidget::predefinedKeys.
Definition elementinfowidget.cpp:262
ElementInfoPartWidget * infoPartWidgetForKey(const QString &key) const
ElementInfoWidget::infoPartWidgetForKey.
Definition elementinfowidget.cpp:321
Definition autonumberingdockwidget.h:30