QElectroTech  0.8-dev
lineeditor.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 LINE_EDITOR_H
19 #define LINE_EDITOR_H
20 
21 #include "elementitemeditor.h"
22 
23 class PartLine;
24 class StyleEditor;
25 class QComboBox;
26 class QDoubleSpinBox;
27 
32 {
33  Q_OBJECT
34  // constructors, destructor
35  public:
36  LineEditor(QETElementEditor *, PartLine * = nullptr, QWidget * = nullptr);
37  ~LineEditor() override;
38  private:
40 
41  // attributes
42  private:
45  QDoubleSpinBox *x1, *y1, *x2, *y2;
46  QComboBox *end1_type, *end2_type;
47  QDoubleSpinBox*end1_length, *end2_length;
48  bool m_locked;
49  QList <QMetaObject::Connection> m_change_connections;
50 
51  // methods
52  public:
53  bool setPart(CustomElementPart *) override;
54  bool setParts(QList <CustomElementPart *> parts) override;
55  CustomElementPart *currentPart() const override;
56  QList<CustomElementPart*> currentParts() const override;
57  QPointF editedP1() const;
58  QPointF editedP2() const;
59 
60  public slots:
61  void updateLineEndType1();
62  void updateLineEndLength1();
63  void updateLineEndType2();
64  void updateLineEndLength2();
65  void lineEditingFinishedX1();
66  void lineEditingFinishedY1();
67  void lineEditingFinishedX2();
68  void lineEditingFinishedY2();
69  void updateForm() override;
70 
71  private:
72  void activeConnections(bool);
80 };
81 #endif
LineEditor
Definition: lineeditor.h:32
elementitemeditor.h
QPropertyUndoCommand::enableAnimation
void enableAnimation(bool animate=true)
QPropertyUndoCommand::enableAnimation True to enable animation.
Definition: qpropertyundocommand.cpp:92
LineEditor::disconnectChangeConnections
void disconnectChangeConnections()
Definition: lineeditor.cpp:104
styleeditor.h
StyleEditor::currentParts
QList< CustomElementPart * > currentParts() const override
Definition: styleeditor.cpp:543
QET::Icons::EndLineSimple
QIcon EndLineSimple
Definition: qeticons.cpp:91
LineEditor::LineEditor
LineEditor(QETElementEditor *, PartLine *=nullptr, QWidget *=nullptr)
Definition: lineeditor.cpp:32
LineEditor::setParts
bool setParts(QList< CustomElementPart * > parts) override
Definition: lineeditor.cpp:145
ElementScene::undoStack
QUndoStack & undoStack()
ElementScene::undoStack.
Definition: elementscene.cpp:603
LineEditor::updateLineEndLength1
void updateLineEndLength1()
Met a jour la longueur de la premiere extremite.
Definition: lineeditor.cpp:204
QET::Icons::EndLineCircle
QIcon EndLineCircle
Definition: qeticons.cpp:88
lineeditor.h
Qet::None
@ None
Regular line.
Definition: qet.h:194
LineEditor::lineEditingFinishedY1
void lineEditingFinishedY1()
Definition: lineeditor.cpp:293
LineEditor::end1_type
QComboBox * end1_type
Definition: lineeditor.h:46
Qet::Simple
@ Simple
Base-less triangle.
Definition: qet.h:195
LineEditor::setPart
bool setPart(CustomElementPart *) override
LineEditor::setPart Specifie to this editor the part to edit. Note that an editor can accept or refus...
Definition: lineeditor.cpp:119
Qet::Diamond
@ Diamond
Diamond.
Definition: qet.h:198
LineEditor::currentPart
CustomElementPart * currentPart() const override
Definition: lineeditor.cpp:158
LineEditor::updateLineEndLength2
void updateLineEndLength2()
Met a jour la longueur de la seconde extremite.
Definition: lineeditor.cpp:247
LineEditor::y2
QDoubleSpinBox * y2
Definition: lineeditor.h:45
LineEditor::lineEditingFinishedX1
void lineEditingFinishedX1()
Definition: lineeditor.cpp:268
partline.h
LineEditor::style_
StyleEditor * style_
Definition: lineeditor.h:44
PartLine::secondEndTypeChanged
void secondEndTypeChanged()
LineEditor::x2
QDoubleSpinBox * x2
Definition: lineeditor.h:45
LineEditor::editedP2
QPointF editedP2() const
LineEditor::editedP2.
Definition: lineeditor.cpp:178
QET::Icons::EndLineNone
QIcon EndLineNone
Definition: qeticons.cpp:90
StyleEditor
Definition: styleeditor.h:35
LineEditor::lineEditingFinishedY2
void lineEditingFinishedY2()
Definition: lineeditor.cpp:343
ElementItemEditor
Definition: elementitemeditor.h:34
PartLine::firstEndLengthChanged
void firstEndLengthChanged()
LineEditor::part
PartLine * part
Definition: lineeditor.h:43
qeticons.h
qet.h
LineEditor::x1
QDoubleSpinBox * x1
Definition: lineeditor.h:45
LineEditor::updateLineEndType2
void updateLineEndType2()
Met a jour le type de la seconde extremite.
Definition: lineeditor.cpp:226
ElementItemEditor::elementScene
virtual ElementScene * elementScene() const
Definition: elementitemeditor.cpp:39
LineEditor::updateLineEndType1
void updateLineEndType1()
Met a jour le type de la premiere extremite.
Definition: lineeditor.cpp:183
LineEditor::y1
QDoubleSpinBox * y1
Definition: lineeditor.h:45
LineEditor::lineEditingFinishedX2
void lineEditingFinishedX2()
Definition: lineeditor.cpp:318
LineEditor::~LineEditor
~LineEditor() override
Destructeur.
Definition: lineeditor.cpp:92
LineEditor::editedP1
QPointF editedP1() const
LineEditor::editedP1.
Definition: lineeditor.cpp:170
PartLine::firstEndTypeChanged
void firstEndTypeChanged()
PartLine
Definition: partline.h:37
elementscene.h
LineEditor::end2_length
QDoubleSpinBox * end2_length
Definition: lineeditor.h:47
qpropertyundocommand.h
LineEditor::currentParts
QList< CustomElementPart * > currentParts() const override
Definition: lineeditor.cpp:162
LineEditor::activeConnections
void activeConnections(bool)
LineEditor::activeConnections Enable/disable connection between editor widget and slot editingFinishe...
Definition: lineeditor.cpp:395
LineEditor::LineEditor
LineEditor(const LineEditor &)
PartLine::lineChanged
void lineChanged()
LineEditor::end1_length
QDoubleSpinBox * end1_length
Definition: lineeditor.h:47
StyleEditor::setParts
bool setParts(QList< CustomElementPart * >) override
StyleEditor::setParts Set several parts to edit by this editor. Note : editor can accept or refuse to...
Definition: styleeditor.cpp:510
LineEditor::end2_type
QComboBox * end2_type
Definition: lineeditor.h:46
QET::Icons::EndLineTriangle
QIcon EndLineTriangle
Definition: qeticons.cpp:92
Qet::Circle
@ Circle
Circle.
Definition: qet.h:197
CustomElementPart
The CustomElementPart class This abstract class represents a primitive of the visual representation o...
Definition: customelementpart.h:40
Qet::Triangle
@ Triangle
Triangle.
Definition: qet.h:196
QET::Icons::EndLineDiamond
QIcon EndLineDiamond
Definition: qeticons.cpp:89
PartLine::secondEndLengthChanged
void secondEndLengthChanged()
QPropertyUndoCommand
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition: qpropertyundocommand.h:34
LineEditor::m_locked
bool m_locked
Definition: lineeditor.h:48
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
LineEditor::setUpChangeConnections
void setUpChangeConnections()
setUpChangeConnections Setup the connection from the line(s) to the widget, to update it when the lin...
Definition: lineeditor.cpp:95
LineEditor::m_change_connections
QList< QMetaObject::Connection > m_change_connections
Definition: lineeditor.h:49
QETElementEditor
Definition: qetelementeditor.h:33
CustomElementGraphicPart::property
QVariant property(const char *name) const override
Definition: customelementgraphicpart.h:297
LineEditor::updateForm
void updateForm() override
LineEditor::updateForm Update the value of the widgets.
Definition: lineeditor.cpp:372