LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
textgraphicsitem.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_TEXTGRAPHICSITEM_H
21 #define LIBREPCB_TEXTGRAPHICSITEM_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../geometry/text.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 TextGraphicsItem
42  ******************************************************************************/
43 
52  public IF_TextObserver {
53 public:
54  // Constructors / Destructor
55  TextGraphicsItem() = delete;
56  TextGraphicsItem(const TextGraphicsItem& other) = delete;
58  QGraphicsItem* parent = nullptr) noexcept;
59  ~TextGraphicsItem() noexcept;
60 
61  // Getters
62  Text& getText() noexcept { return mText; }
63 
64  // Operator Overloadings
65  TextGraphicsItem& operator=(const TextGraphicsItem& rhs) = delete;
66 
67 private: // Methods
69  const GraphicsLayerName& newLayerName) noexcept override;
70  void textTextChanged(const QString& newText) noexcept override;
71  void textPositionChanged(const Point& newPos) noexcept override;
72  void textRotationChanged(const Angle& newRot) noexcept override;
73  void textHeightChanged(const PositiveLength& newHeight) noexcept override;
74  void textAlignChanged(const Alignment& newAlign) noexcept override;
75 
76 private: // Data
79  QScopedPointer<OriginCrossGraphicsItem> mOriginCrossGraphicsItem;
80 };
81 
82 /*******************************************************************************
83  * End of File
84  ******************************************************************************/
85 
86 } // namespace librepcb
87 
88 #endif // LIBREPCB_TEXTGRAPHICSITEM_H
void textAlignChanged(const Alignment &newAlign) noexceptoverride
Definition: textgraphicsitem.cpp:94
~TextGraphicsItem() noexcept
Definition: textgraphicsitem.cpp:64
The Alignment class.
Definition: alignment.h:193
const IF_GraphicsLayerProvider & mLayerProvider
Definition: textgraphicsitem.h:78
type_safe::constrained_type< QString, GraphicsLayerNameConstraint, GraphicsLayerNameVerifier > GraphicsLayerName
Definition: graphicslayername.h:78
TextGraphicsItem & operator=(const TextGraphicsItem &rhs)=delete
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
Text & getText() noexcept
Definition: textgraphicsitem.h:62
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
QScopedPointer< OriginCrossGraphicsItem > mOriginCrossGraphicsItem
Definition: textgraphicsitem.h:79
Text & mText
Definition: textgraphicsitem.h:77
void textLayerNameChanged(const GraphicsLayerName &newLayerName) noexceptoverride
Definition: textgraphicsitem.cpp:72
void textHeightChanged(const PositiveLength &newHeight) noexceptoverride
Definition: textgraphicsitem.cpp:89
void textPositionChanged(const Point &newPos) noexceptoverride
Definition: textgraphicsitem.cpp:81
void textRotationChanged(const Angle &newRot) noexceptoverride
Definition: textgraphicsitem.cpp:85
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:783
The Text class.
Definition: text.h:75
The TextGraphicsItem class is the graphical representation of a librepcb::Text.
Definition: textgraphicsitem.h:51
void textTextChanged(const QString &newText) noexceptoverride
Definition: textgraphicsitem.cpp:77
The IF_TextObserver class.
Definition: text.h:51
The PrimitiveTextGraphicsItem class is the graphical representation of a text.
Definition: primitivetextgraphicsitem.h:51