QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
qetelementeditor.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 QETELEMENTEDITOR_H
19#define QETELEMENTEDITOR_H
20
22
23#include <QCloseEvent>
24#include <QMainWindow>
25
26class ElementScene;
27class QActionGroup;
29class ElementView;
30class QListWidget;
31class QStackedWidget;
32class QLabel;
33
34namespace Ui {
35 class QETElementEditor;
36}
37
38class QETElementEditor : public QMainWindow
39{
40 Q_OBJECT
41 signals:
43
44 public:
45 explicit QETElementEditor(QWidget *parent = nullptr);
46 ~QETElementEditor() override;
47
48 void contextMenu(QPoint p, QList<QAction *> actions = QList<QAction *>());
49 void setNames(const NamesList &name_list);
52 void setFileName(const QString &file_name);
53 QString fileName() const;
54 void setReadOnly(bool ro);
55 bool isReadOnly() const;
56 void fromFile(const QString &filepath);
57 bool toFile(const QString &filepath);
61 bool isEditing(const QString &filepath);
63 ElementView *elementView() const;
64 static QPointF pasteOffset();
65 static QString getOpenElementFileName(QWidget *parent = nullptr, const QString &dir = QString());
66 void updateTitle();
67 void fillPartsList();
70 void updateInformations();
71 void updatePartsList();
73 void openElement(const QString &filepath);
74 bool checkElement();
75
76 protected:
77 bool event(QEvent *event) override;
78 void closeEvent(QCloseEvent *) override;
79
80
81 private slots:
115
116 private:
117 bool canClose();
118 void readSettings();
119 void readSettingsState();
120 void writeSettings() const;
121 void setupActions();
122 void updateAction();
123 void setupConnection();
124 void initGui();
125 QWidget *clearToolsDock();
126 void copyAndPasteXml(const QDomDocument &xml_document);
127
128 private:
129 Ui::QETElementEditor *ui;
130
131 bool
132 m_read_only = false,
135
137
138 QActionGroup
141
143
144 QAction
145 *m_undo_action = nullptr,
146 *m_redo_action = nullptr;
147
148
150 QHash<QString, ElementItemEditor *> m_editors;
151
153
154 QString
157
158 ElementView *m_view = nullptr;
159
160 QListWidget *m_parts_list = nullptr;
161
162 QStackedWidget *m_tools_dock_stack = nullptr;
163
164 QLabel *m_default_informations = nullptr;
165
166 QLabel *m_position_label = nullptr;
167
168};
169
170#endif // QETELEMENTEDITOR_H
Definition elementitemeditor.h:34
The ElementScene class This class is the canvas allowing the visual edition of an electrical element....
Definition elementscene.h:46
Definition elementview.h:27
The ElementsLocation class This class represents the location, the location of an element or of a cat...
Definition elementslocation.h:47
Definition nameslist.h:37
void on_m_zoom_in_action_triggered()
Definition qetelementeditor.cpp:1596
void on_m_new_action_triggered()
Definition qetelementeditor.cpp:1347
void on_m_zoom_original_action_triggered()
Definition qetelementeditor.cpp:1602
QString m_min_title
Definition qetelementeditor.h:156
bool checkElement()
QETElementEditor::checkElement Do several check about element.
Definition qetelementeditor.cpp:733
QListWidget * m_parts_list
Definition qetelementeditor.h:160
QString fileName() const
QETElementEditor::fileName.
Definition qetelementeditor.cpp:190
void on_m_revert_selection_action_triggered()
Definition qetelementeditor.cpp:1588
QLabel * m_position_label
Definition qetelementeditor.h:166
void setupActions()
QETElementEditor::setupActions.
Definition qetelementeditor.cpp:992
void on_m_copy_action_triggered()
Definition qetelementeditor.cpp:1525
void setupConnection()
QETElementEditor::setupConnection.
Definition qetelementeditor.cpp:1143
bool m_read_only
Definition qetelementeditor.h:132
void updatePartsList()
QETElementEditor::updatePartsList.
Definition qetelementeditor.cpp:686
bool on_m_save_action_triggered()
QETElementEditor::on_m_save_action_triggered.
Definition qetelementeditor.cpp:1277
ElementView * m_view
Definition qetelementeditor.h:158
ElementScene * m_elmt_scene
Definition qetelementeditor.h:136
QHash< QString, ElementItemEditor * > m_editors
Hash associating primitive names with their matching edition widget.
Definition qetelementeditor.h:150
void on_m_open_action_triggered()
Definition qetelementeditor.cpp:1353
void on_m_select_all_act_triggered()
Definition qetelementeditor.cpp:1341
void on_m_youtube_action_triggered()
Definition qetelementeditor.cpp:1611
void on_m_delete_action_triggered()
Definition qetelementeditor.cpp:1590
void contextMenu(QPoint p, QList< QAction * > actions=QList< QAction * >())
QETElementEditor::contextMenu Display a context menu, with all available action.
Definition qetelementeditor.cpp:101
void initGui()
QETElementEditor::initGui.
Definition qetelementeditor.cpp:1171
QLabel * m_default_informations
Definition qetelementeditor.h:164
QActionGroup * m_add_part_action_grp
Definition qetelementeditor.h:139
bool on_m_export_svg_action_triggered()
QETElementEditor::on_m_export_svg_action_triggered Export the element currently open in this editor t...
Definition qetelementeditor.cpp:1423
bool toFile(const QString &filepath)
QETElementEditor::toFile Save to a file the current edited element.
Definition qetelementeditor.cpp:271
void on_m_zoom_fit_best_action_triggered()
Definition qetelementeditor.cpp:1600
Ui::QETElementEditor * ui
Definition qetelementeditor.h:129
bool canClose()
QETElementEditor::canClose.
Definition qetelementeditor.cpp:905
void saveToLocation(ElementsLocation loc)
QList< QAction * > m_context_menu_action_list
Definition qetelementeditor.h:142
void on_m_paste_action_triggered()
Definition qetelementeditor.cpp:1527
QStackedWidget * m_tools_dock_stack
Definition qetelementeditor.h:162
bool on_m_save_as_file_action_triggered()
Definition qetelementeditor.cpp:1369
QString m_file_name
Definition qetelementeditor.h:155
void on_m_paste_in_area_action_triggered()
Definition qetelementeditor.cpp:1529
void on_m_import_dxf_triggered()
Definition qetelementeditor.cpp:1623
void on_m_about_qt_action_triggered()
Definition qetelementeditor.cpp:1621
void on_m_online_manual_triggered()
Definition qetelementeditor.cpp:1606
void writeSettings() const
QETElementEditor::writeSettings Write some setting of this widget in the QSetting of qelectrotech.
Definition qetelementeditor.cpp:982
void UncheckAddPrimitive()
QETElementEditor::UncheckAddPrimitive.
Definition qetelementeditor.cpp:508
void readSettings()
QETElementEditor::readSettings Read some setting about this widget in the QSetting of qelectrotech.
Definition qetelementeditor.cpp:946
void on_m_paste_from_element_action_triggered()
Definition qetelementeditor.cpp:1559
QActionGroup * m_depth_action_group
Definition qetelementeditor.h:140
void updateInformations()
QETElementEditor::updateInformations Update the information and editor dock.
Definition qetelementeditor.cpp:532
bool on_m_save_as_action_triggered()
QETElementEditor::on_m_save_as_action_triggered Ask a location to user and save the current edited el...
Definition qetelementeditor.cpp:1318
static QString getOpenElementFileName(QWidget *parent=nullptr, const QString &dir=QString())
QETElementEditor::getOpenElementFileName Ask user to open a file who must be an element.
Definition qetelementeditor.cpp:427
void setNames(const NamesList &name_list)
QETElementEditor::setNames Set the names list of the edited element.
Definition qetelementeditor.cpp:141
QAction * m_undo_action
Definition qetelementeditor.h:145
void readSettingsState()
QETElementEditor::readSettingsState Restore the window state (docks, toolbars). Must be called AFTER ...
Definition qetelementeditor.cpp:965
void copyAndPasteXml(const QDomDocument &xml_document)
QETElementEditor::copyAndPasteXml Copy the content of @xml_document to the clipboard and call pasteIn...
Definition qetelementeditor.cpp:1260
void on_m_reload_action_triggered()
Definition qetelementeditor.cpp:1495
bool event(QEvent *event) override
QETElementEditor::event.
Definition qetelementeditor.cpp:849
void on_m_import_scaled_element_triggered()
Definition qetelementeditor.cpp:1649
void on_m_cut_action_triggered()
Definition qetelementeditor.cpp:1523
void on_m_edit_names_action_triggered()
Definition qetelementeditor.cpp:1592
bool toLocation(const ElementsLocation &location)
QETElementEditor::toLocation Save the edited element into @location.
Definition qetelementeditor.cpp:338
ElementScene * elementScene() const
QETElementEditor::elementScene.
Definition qetelementeditor.cpp:398
void fillPartsList()
QETElementEditor::fillPartsList.
Definition qetelementeditor.cpp:465
ElementsLocation m_location
Definition qetelementeditor.h:152
QETElementEditor(QWidget *parent=nullptr)
QETElementEditor::QETElementEditor.
Definition qetelementeditor.cpp:64
ElementsLocation location() const
QETElementEditor::location.
Definition qetelementeditor.cpp:166
void on_m_quit_action_triggered()
Definition qetelementeditor.cpp:1519
void updateTitle()
QETElementEditor::updateTitle Update the title of the windows.
Definition qetelementeditor.cpp:447
bool isReadOnly() const
Definition qetelementeditor.cpp:201
void on_m_paste_from_file_action_triggered()
Definition qetelementeditor.cpp:1531
void setFileName(const QString &file_name)
QETElementEditor::setFileName Set the file name of the edited element.
Definition qetelementeditor.cpp:175
void closeEvent(QCloseEvent *) override
QETElementEditor::closeEvent.
Definition qetelementeditor.cpp:888
QWidget * clearToolsDock()
QETElementEditor::clearToolsDock Remove and hide the widget displayed by the dock used to edit primit...
Definition qetelementeditor.cpp:1244
void on_m_open_from_file_action_triggered()
Definition qetelementeditor.cpp:1362
void on_m_edit_author_action_triggered()
Definition qetelementeditor.cpp:1594
void fromLocation(const ElementsLocation &location)
QETElementEditor::fromLocation Location of an element to edit.
Definition qetelementeditor.cpp:293
void on_m_edit_element_properties_action_triggered()
Definition qetelementeditor.cpp:1345
bool m_first_activation
Definition qetelementeditor.h:134
void updateCurrentPartEditor()
QETElementEditor::updateCurrentPartEditor.
Definition qetelementeditor.cpp:517
void on_m_deselect_all_action_triggered()
Definition qetelementeditor.cpp:1521
void on_m_zoom_out_action_triggered()
Definition qetelementeditor.cpp:1598
void openElement(const QString &filepath)
QETElementEditor::openElement OPen an element from @filepath.
Definition qetelementeditor.cpp:864
~QETElementEditor() override
QETElementEditor::~QETElementEditor.
Definition qetelementeditor.cpp:89
static QPointF pasteOffset()
QETElementEditor::pasteOffset.
Definition qetelementeditor.cpp:414
bool isEditing(const ElementsLocation &location)
QETElementEditor::isEditing.
Definition qetelementeditor.cpp:359
void setReadOnly(bool ro)
Definition qetelementeditor.cpp:194
void fromFile(const QString &filepath)
QETElementEditor::fromFile Open an element from @filepath.
Definition qetelementeditor.cpp:210
void updateSelectionFromPartsList()
QETElementEditor::updateSelectionFromPartsList.
Definition qetelementeditor.cpp:711
ElementView * elementView() const
QETElementEditor::elementView.
Definition qetelementeditor.cpp:406
void updateAction()
QETElementEditor::updateAction Update actions.
Definition qetelementeditor.cpp:1101
void on_m_donate_action_triggered()
Definition qetelementeditor.cpp:1616
void on_m_about_qet_action_triggered()
Definition qetelementeditor.cpp:1604
QAction * m_redo_action
Definition qetelementeditor.h:146
void setLocation(const ElementsLocation &location)
QETElementEditor::setLocation Set the location to edit.
Definition qetelementeditor.cpp:153
bool m_opened_from_file
Definition qetelementeditor.h:133
Definition autonumberingdockwidget.h:30