LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
stroketextgraphicsitem.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_STROKETEXTGRAPHICSITEM_H
21 #define LIBREPCB_STROKETEXTGRAPHICSITEM_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../geometry/stroketext.h"
28 
29 #include <QtCore>
30 #include <QtWidgets>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 
37 class OriginCrossGraphicsItem;
38 class IF_GraphicsLayerProvider;
39 
40 /*******************************************************************************
41  * Class StrokeTextGraphicsItem
42  ******************************************************************************/
43 
49  public IF_StrokeTextObserver {
50 public:
51  // Constructors / Destructor
52  StrokeTextGraphicsItem() = delete;
53  StrokeTextGraphicsItem(const StrokeTextGraphicsItem& other) = delete;
55  QGraphicsItem* parent = nullptr) noexcept;
56  ~StrokeTextGraphicsItem() noexcept;
57 
58  // Getters
59  StrokeText& getText() noexcept { return mText; }
60 
61  // Inherited from QGraphicsItem
62  QPainterPath shape() const noexcept override;
63 
64  // Operator Overloadings
65  StrokeTextGraphicsItem& operator=(const StrokeTextGraphicsItem& rhs) = delete;
66 
67 private: // Methods
69  const GraphicsLayerName& newLayerName) noexcept override;
70  void strokeTextTextChanged(const QString& newText) noexcept override;
71  void strokeTextPositionChanged(const Point& newPos) noexcept override;
72  void strokeTextRotationChanged(const Angle& newRot) noexcept override;
74  const PositiveLength& newHeight) noexcept override;
76  const UnsignedLength& newStrokeWidth) noexcept override;
78  const StrokeTextSpacing& spacing) noexcept override;
80  const StrokeTextSpacing& spacing) noexcept override;
81  void strokeTextAlignChanged(const Alignment& newAlign) noexcept override;
82  void strokeTextMirroredChanged(bool mirrored) noexcept override;
83  void strokeTextAutoRotateChanged(bool newAutoRotate) noexcept override;
84  void strokeTextPathsChanged(const QVector<Path>& paths) noexcept override;
85  void updateLayer(const GraphicsLayerName& layerName) noexcept;
86  void updateTransform() noexcept;
87  QVariant itemChange(GraphicsItemChange change,
88  const QVariant& value) noexcept override;
89 
90 private: // Data
94 };
95 
96 /*******************************************************************************
97  * End of File
98  ******************************************************************************/
99 
100 } // namespace librepcb
101 
102 #endif // LIBREPCB_STROKETEXTGRAPHICSITEM_H
void updateTransform() noexcept
Definition: stroketextgraphicsitem.cpp:156
void strokeTextAlignChanged(const Alignment &newAlign) noexceptoverride
Definition: stroketextgraphicsitem.cpp:127
The Alignment class.
Definition: alignment.h:193
void strokeTextRotationChanged(const Angle &newRot) noexceptoverride
Definition: stroketextgraphicsitem.cpp:96
void strokeTextLetterSpacingChanged(const StrokeTextSpacing &spacing) noexceptoverride
Definition: stroketextgraphicsitem.cpp:115
void strokeTextTextChanged(const QString &newText) noexceptoverride
Definition: stroketextgraphicsitem.cpp:85
void strokeTextStrokeWidthChanged(const UnsignedLength &newStrokeWidth) noexceptoverride
Definition: stroketextgraphicsitem.cpp:108
QScopedPointer< OriginCrossGraphicsItem > mOriginCrossGraphicsItem
Definition: stroketextgraphicsitem.h:93
type_safe::constrained_type< QString, GraphicsLayerNameConstraint, GraphicsLayerNameVerifier > GraphicsLayerName
Definition: graphicslayername.h:78
The StrokeText class.
Definition: stroketext.h:153
QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexceptoverride
Definition: stroketextgraphicsitem.cpp:163
void strokeTextAutoRotateChanged(bool newAutoRotate) noexceptoverride
Definition: stroketextgraphicsitem.cpp:138
void updateLayer(const GraphicsLayerName &layerName) noexcept
Definition: stroketextgraphicsitem.cpp:149
StrokeText & getText() noexcept
Definition: stroketextgraphicsitem.h:59
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:81
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:250
The PrimitivePathGraphicsItem class.
Definition: primitivepathgraphicsitem.h:47
StrokeText & mText
Definition: stroketextgraphicsitem.h:91
The StrokeTextSpacing class.
Definition: stroketext.h:52
The IF_StrokeTextObserver class.
Definition: stroketext.h:119
~StrokeTextGraphicsItem() noexcept
Definition: stroketextgraphicsitem.cpp:64
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
void strokeTextLineSpacingChanged(const StrokeTextSpacing &spacing) noexceptoverride
Definition: stroketextgraphicsitem.cpp:121
void strokeTextPositionChanged(const Point &newPos) noexceptoverride
Definition: stroketextgraphicsitem.cpp:91
QPainterPath shape() const noexceptoverride
Definition: stroketextgraphicsitem.cpp:72
The StrokeTextGraphicsItem class is the graphical representation of a librepcb::StrokeText.
Definition: stroketextgraphicsitem.h:48
The Path class represents a list of vertices connected by straight lines or circular arc segments...
Definition: path.h:53
void strokeTextHeightChanged(const PositiveLength &newHeight) noexceptoverride
Definition: stroketextgraphicsitem.cpp:102
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:783
void strokeTextMirroredChanged(bool mirrored) noexceptoverride
Definition: stroketextgraphicsitem.cpp:133
void strokeTextPathsChanged(const QVector< Path > &paths) noexceptoverride
Definition: stroketextgraphicsitem.cpp:144
The OriginCrossGraphicsItem class.
Definition: origincrossgraphicsitem.h:47
void strokeTextLayerNameChanged(const GraphicsLayerName &newLayerName) noexceptoverride
Definition: stroketextgraphicsitem.cpp:80
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:662
const IF_GraphicsLayerProvider & mLayerProvider
Definition: stroketextgraphicsitem.h:92