QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
qetelementeditor.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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
21#include "../../ElementsCollection/elementslocation.h"
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:
114
115 private:
116 bool canClose();
117 void readSettings();
118 void writeSettings() const;
119 void setupActions();
120 void updateAction();
121 void setupConnection();
122 void initGui();
123 QWidget *clearToolsDock();
124 void copyAndPasteXml(const QDomDocument &xml_document);
125
126 private:
127 Ui::QETElementEditor *ui;
128
129 bool
130 m_read_only = false,
133
135
136 QActionGroup
139
141
142 QAction
143 *m_undo_action = nullptr,
144 *m_redo_action = nullptr;
145
146
148 QHash<QString, ElementItemEditor *> m_editors;
149
151
152 QString
155
156 ElementView *m_view = nullptr;
157
158 QListWidget *m_parts_list = nullptr;
159
160 QStackedWidget *m_tools_dock_stack = nullptr;
161
162 QLabel *m_default_informations = nullptr;
163
164};
165
166#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:31
Definition qetelementeditor.h:39
void on_m_zoom_in_action_triggered()
Definition qetelementeditor.cpp:1474
void on_m_new_action_triggered()
Definition qetelementeditor.cpp:1295
void on_m_zoom_original_action_triggered()
Definition qetelementeditor.cpp:1480
QString m_min_title
Definition qetelementeditor.h:154
bool checkElement()
QETElementEditor::checkElement Do several check about element.
Definition qetelementeditor.cpp:728
QListWidget * m_parts_list
Definition qetelementeditor.h:158
QString fileName() const
QETElementEditor::fileName.
Definition qetelementeditor.cpp:181
void on_m_revert_selection_action_triggered()
Definition qetelementeditor.cpp:1466
void setupActions()
QETElementEditor::setupActions.
Definition qetelementeditor.cpp:951
void on_m_copy_action_triggered()
Definition qetelementeditor.cpp:1403
void setupConnection()
QETElementEditor::setupConnection.
Definition qetelementeditor.cpp:1118
bool m_read_only
Definition qetelementeditor.h:130
void updatePartsList()
QETElementEditor::updatePartsList.
Definition qetelementeditor.cpp:681
bool on_m_save_action_triggered()
QETElementEditor::on_m_save_action_triggered.
Definition qetelementeditor.cpp:1225
ElementView * m_view
Definition qetelementeditor.h:156
ElementScene * m_elmt_scene
Definition qetelementeditor.h:134
QHash< QString, ElementItemEditor * > m_editors
Hash associating primitive names with their matching edition widget.
Definition qetelementeditor.h:148
void on_m_open_action_triggered()
Definition qetelementeditor.cpp:1301
void on_m_select_all_act_triggered()
Definition qetelementeditor.cpp:1289
void on_m_youtube_action_triggered()
Definition qetelementeditor.cpp:1489
void on_m_delete_action_triggered()
Definition qetelementeditor.cpp:1468
void contextMenu(QPoint p, QList< QAction * > actions=QList< QAction * >())
QETElementEditor::contextMenu Display a context menu, with all available action.
Definition qetelementeditor.cpp:95
void initGui()
QETElementEditor::initGui.
Definition qetelementeditor.cpp:1146
QLabel * m_default_informations
Definition qetelementeditor.h:162
QActionGroup * m_add_part_action_grp
Definition qetelementeditor.h:137
bool toFile(const QString &filepath)
QETElementEditor::toFile Save to a file the current edited element.
Definition qetelementeditor.cpp:262
void on_m_zoom_fit_best_action_triggered()
Definition qetelementeditor.cpp:1478
Ui::QETElementEditor * ui
Definition qetelementeditor.h:127
bool canClose()
QETElementEditor::canClose.
Definition qetelementeditor.cpp:876
void saveToLocation(ElementsLocation loc)
QList< QAction * > m_context_menu_action_list
Definition qetelementeditor.h:140
void on_m_open_dxf_action_triggered()
Definition qetelementeditor.cpp:1317
void on_m_paste_action_triggered()
Definition qetelementeditor.cpp:1405
QStackedWidget * m_tools_dock_stack
Definition qetelementeditor.h:160
bool on_m_save_as_file_action_triggered()
Definition qetelementeditor.cpp:1335
QString m_file_name
Definition qetelementeditor.h:153
void on_m_paste_in_area_action_triggered()
Definition qetelementeditor.cpp:1407
void on_m_import_dxf_triggered()
Definition qetelementeditor.cpp:1501
void on_m_about_qt_action_triggered()
Definition qetelementeditor.cpp:1499
void on_m_online_manual_triggered()
Definition qetelementeditor.cpp:1484
void writeSettings() const
QETElementEditor::writeSettings Write some setting of this widget in the QSetting of qelectrotech.
Definition qetelementeditor.cpp:941
void UncheckAddPrimitive()
QETElementEditor::UncheckAddPrimitive.
Definition qetelementeditor.cpp:503
void readSettings()
QETElementEditor::readSettings Read some setting about this widget in the QSetting of qelectrotech.
Definition qetelementeditor.cpp:917
void on_m_paste_from_element_action_triggered()
Definition qetelementeditor.cpp:1437
QActionGroup * m_depth_action_group
Definition qetelementeditor.h:138
void updateInformations()
QETElementEditor::updateInformations Update the information and editor dock.
Definition qetelementeditor.cpp:527
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:1266
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:418
void setNames(const NamesList &name_list)
QETElementEditor::setNames Set the names list of the edited element.
Definition qetelementeditor.cpp:132
QAction * m_undo_action
Definition qetelementeditor.h:143
void copyAndPasteXml(const QDomDocument &xml_document)
QETElementEditor::copyAndPasteXml Copy the content of @xml_document to the clipboard and call pasteIn...
Definition qetelementeditor.cpp:1208
void on_m_reload_action_triggered()
Definition qetelementeditor.cpp:1373
bool event(QEvent *event) override
QETElementEditor::event.
Definition qetelementeditor.cpp:820
void on_m_cut_action_triggered()
Definition qetelementeditor.cpp:1401
void on_m_edit_names_action_triggered()
Definition qetelementeditor.cpp:1470
bool toLocation(const ElementsLocation &location)
QETElementEditor::toLocation Save the edited element into @location.
Definition qetelementeditor.cpp:329
ElementScene * elementScene() const
QETElementEditor::elementScene.
Definition qetelementeditor.cpp:389
void fillPartsList()
QETElementEditor::fillPartsList.
Definition qetelementeditor.cpp:456
ElementsLocation m_location
Definition qetelementeditor.h:150
ElementsLocation location() const
QETElementEditor::location.
Definition qetelementeditor.cpp:157
void on_m_quit_action_triggered()
Definition qetelementeditor.cpp:1397
void updateTitle()
QETElementEditor::updateTitle Update the title of the windows.
Definition qetelementeditor.cpp:438
bool isReadOnly() const
Definition qetelementeditor.cpp:192
void on_m_paste_from_file_action_triggered()
Definition qetelementeditor.cpp:1409
void setFileName(const QString &file_name)
QETElementEditor::setFileName Set the file name of the edited element.
Definition qetelementeditor.cpp:166
void closeEvent(QCloseEvent *) override
QETElementEditor::closeEvent.
Definition qetelementeditor.cpp:859
QWidget * clearToolsDock()
QETElementEditor::clearToolsDock Remove and hide the widget displayed by the dock used to edit primit...
Definition qetelementeditor.cpp:1192
void on_m_open_from_file_action_triggered()
Definition qetelementeditor.cpp:1310
void on_m_edit_author_action_triggered()
Definition qetelementeditor.cpp:1472
void fromLocation(const ElementsLocation &location)
QETElementEditor::fromLocation Location of an element to edit.
Definition qetelementeditor.cpp:284
void on_m_edit_element_properties_action_triggered()
Definition qetelementeditor.cpp:1293
bool m_first_activation
Definition qetelementeditor.h:132
void updateCurrentPartEditor()
QETElementEditor::updateCurrentPartEditor.
Definition qetelementeditor.cpp:512
void on_m_deselect_all_action_triggered()
Definition qetelementeditor.cpp:1399
void on_m_zoom_out_action_triggered()
Definition qetelementeditor.cpp:1476
void openElement(const QString &filepath)
QETElementEditor::openElement OPen an element from @filepath.
Definition qetelementeditor.cpp:835
~QETElementEditor() override
QETElementEditor::~QETElementEditor.
Definition qetelementeditor.cpp:83
static QPointF pasteOffset()
QETElementEditor::pasteOffset.
Definition qetelementeditor.cpp:405
bool isEditing(const ElementsLocation &location)
QETElementEditor::isEditing.
Definition qetelementeditor.cpp:350
void setReadOnly(bool ro)
Definition qetelementeditor.cpp:185
void fromFile(const QString &filepath)
QETElementEditor::fromFile Open an element from @filepath.
Definition qetelementeditor.cpp:201
void updateSelectionFromPartsList()
QETElementEditor::updateSelectionFromPartsList.
Definition qetelementeditor.cpp:706
ElementView * elementView() const
QETElementEditor::elementView.
Definition qetelementeditor.cpp:397
void updateAction()
QETElementEditor::updateAction Update actions.
Definition qetelementeditor.cpp:1079
void on_m_donate_action_triggered()
Definition qetelementeditor.cpp:1494
void on_m_about_qet_action_triggered()
Definition qetelementeditor.cpp:1482
QAction * m_redo_action
Definition qetelementeditor.h:144
void setLocation(const ElementsLocation &location)
QETElementEditor::setLocation Set the location to edit.
Definition qetelementeditor.cpp:144
bool m_opened_from_file
Definition qetelementeditor.h:131
Definition autonumberingdockwidget.h:26