QElectroTech  0.8-dev
polygoneditor.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 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 POLYGONEDITOR_H
19 #define POLYGONEDITOR_H
20 
21 #include "elementitemeditor.h"
22 
23 class StyleEditor;
24 class PartPolygon;
25 class QTreeWidgetItem;
26 
27 namespace Ui {
28  class PolygonEditor;
29 }
30 
32 {
33  Q_OBJECT
34 
35  public:
36  explicit PolygonEditor(QETElementEditor *editor, PartPolygon *part = nullptr, QWidget *parent = nullptr);
37  ~PolygonEditor() override;
38 
39  bool setPart(CustomElementPart *part) override;
40  CustomElementPart *currentPart() const override;
41  QList<CustomElementPart*> currentParts() const override;
42  void updateForm() override;
43  QVector<QPointF> pointsFromTree();
44  bool eventFilter(QObject *watched, QEvent *event) override;
45 
46  private slots:
48  void on_m_points_list_tree_itemChanged(QTreeWidgetItem *item, int column);
52 
53  private:
61 
62  private:
63  Ui::PolygonEditor *ui;
64  StyleEditor *m_style = nullptr;
65  PartPolygon *m_part = nullptr;
66  QList <QMetaObject::Connection> m_change_connections;
67 };
68 
69 #endif // POLYGONEDITOR_H
elementitemeditor.h
PolygonEditor::updateForm
void updateForm() override
PolygonEditor::updateForm Update the widget.
Definition: polygoneditor.cpp:130
styleeditor.h
PolygonEditor::PolygonEditor
PolygonEditor(QETElementEditor *editor, PartPolygon *part=nullptr, QWidget *parent=nullptr)
PolygonEditor::PolygonEditor.
Definition: polygoneditor.cpp:32
StyleEditor::currentParts
QList< CustomElementPart * > currentParts() const override
Definition: styleeditor.cpp:543
ElementScene::undoStack
QUndoStack & undoStack()
ElementScene::undoStack.
Definition: elementscene.cpp:603
PolygonEditor::setUpChangeConnections
void setUpChangeConnections()
setUpChangeConnections Setup the connection from the line(s) to the widget, to update it when the lin...
Definition: polygoneditor.cpp:55
PartPolygon::setHandlerColor
void setHandlerColor(QPointF pos, const QColor &color) final
PartPolygon::setHandlerColor Set the handler at pos pos (in polygon coordinate) to color color.
Definition: partpolygon.cpp:266
PolygonEditor::ui
Ui::PolygonEditor * ui
Definition: polygoneditor.h:63
PartPolygon::isClosed
bool isClosed() const
Definition: partpolygon.h:84
PolygonEditor::on_m_add_point_action_triggered
void on_m_add_point_action_triggered()
Definition: polygoneditor.cpp:279
PartPolygon::polygon
QPolygonF polygon
Definition: partpolygon.h:38
PolygonEditor
Definition: polygoneditor.h:32
qetmessagebox.h
PolygonEditor::m_part
PartPolygon * m_part
Definition: polygoneditor.h:65
PolygonEditor::currentPart
CustomElementPart * currentPart() const override
PolygonEditor::currentPart.
Definition: polygoneditor.cpp:118
PolygonEditor::on_m_points_list_tree_itemChanged
void on_m_points_list_tree_itemChanged(QTreeWidgetItem *item, int column)
PolygonEditor::on_m_points_list_tree_itemChanged Update the polygon according to the current value of...
Definition: polygoneditor.cpp:217
PolygonEditor::m_style
StyleEditor * m_style
Definition: polygoneditor.h:64
PartPolygon
The PartPolygon class This class represents a polygon primitive which may be used to compose the draw...
Definition: partpolygon.h:34
StyleEditor
Definition: styleeditor.h:35
ElementItemEditor
Definition: elementitemeditor.h:34
PolygonEditor::setPart
bool setPart(CustomElementPart *part) override
PolygonEditor::setPart.
Definition: polygoneditor.cpp:88
PartPolygon::resetAllHandlerColor
void resetAllHandlerColor() final
PartPolygon::resetAllHandlerColor Reset the color of every handlers.
Definition: partpolygon.cpp:279
ElementItemEditor::elementScene
virtual ElementScene * elementScene() const
Definition: elementitemeditor.cpp:39
PolygonEditor::disconnectChangeConnections
void disconnectChangeConnections()
Definition: polygoneditor.cpp:75
PartPolygon::closedChange
void closedChange()
PartPolygon::polygonChanged
void polygonChanged()
elementscene.h
PolygonEditor::currentParts
QList< CustomElementPart * > currentParts() const override
Definition: polygoneditor.cpp:122
PolygonEditor::~PolygonEditor
~PolygonEditor() override
PolygonEditor::~PolygonEditor.
Definition: polygoneditor.cpp:51
qpropertyundocommand.h
PolygonEditor::m_change_connections
QList< QMetaObject::Connection > m_change_connections
Definition: polygoneditor.h:66
PolygonEditor::pointsFromTree
QVector< QPointF > pointsFromTree()
PolygonEditor::pointsFromTree.
Definition: polygoneditor.cpp:157
Ui
Definition: autonumberingdockwidget.h:25
PolygonEditor::on_m_remove_point_action_triggered
void on_m_remove_point_action_triggered()
Definition: polygoneditor.cpp:314
QET::QetMessageBox::warning
QMessageBox::StandardButton warning(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
Definition: qetmessagebox.cpp:68
CustomElementPart
The CustomElementPart class This abstract class represents a primitive of the visual representation o...
Definition: customelementpart.h:40
PolygonEditor::on_m_close_polygon_cb_stateChanged
void on_m_close_polygon_cb_stateChanged(int arg1)
PolygonEditor::on_m_close_polygon_cb_stateChanged.
Definition: polygoneditor.cpp:193
PolygonEditor::on_m_points_list_tree_itemSelectionChanged
void on_m_points_list_tree_itemSelectionChanged()
PolygonEditor::on_m_points_list_tree_itemSelectionChanged Used to change the color of the current sel...
Definition: polygoneditor.cpp:254
QPropertyUndoCommand
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition: qpropertyundocommand.h:34
partpolygon.h
polygoneditor.h
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
QETElementEditor
Definition: qetelementeditor.h:33
CustomElementGraphicPart::property
QVariant property(const char *name) const override
Definition: customelementgraphicpart.h:297
ElementItemEditor::undoStack
virtual QUndoStack & undoStack() const
Definition: elementitemeditor.cpp:44
PolygonEditor::eventFilter
bool eventFilter(QObject *watched, QEvent *event) override
Definition: polygoneditor.cpp:177