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:
50  // Constructors / Destructor
51  StrokeTextGraphicsItem() = delete;
52  StrokeTextGraphicsItem(const StrokeTextGraphicsItem& other) = delete;
54  QGraphicsItem* parent = nullptr) noexcept;
55  ~StrokeTextGraphicsItem() noexcept;
56 
57  // Getters
58  StrokeText& getText() noexcept { return mText; }
59 
60  // Inherited from QGraphicsItem
61  QPainterPath shape() const noexcept override;
62 
63  // Operator Overloadings
64  StrokeTextGraphicsItem& operator=(const StrokeTextGraphicsItem& rhs) = delete;
65 
66 private: // Methods
67  void strokeTextEdited(const StrokeText& text,
68  StrokeText::Event event) noexcept;
69  void updateLayer(const GraphicsLayerName& layerName) noexcept;
70  void updateTransform() noexcept;
71  QVariant itemChange(GraphicsItemChange change,
72  const QVariant& value) noexcept override;
73 
74 private: // Data
78 
79  // Slots
80  StrokeText::OnEditedSlot mOnEditedSlot;
81 };
82 
83 /*******************************************************************************
84  * End of File
85  ******************************************************************************/
86 
87 } // namespace librepcb
88 
89 #endif // LIBREPCB_STROKETEXTGRAPHICSITEM_H
void strokeTextEdited(const StrokeText &text, StrokeText::Event event) noexcept
Definition: stroketextgraphicsitem.cpp:82
void updateTransform() noexcept
Definition: stroketextgraphicsitem.cpp:126
StrokeText::OnEditedSlot mOnEditedSlot
Definition: stroketextgraphicsitem.h:80
QScopedPointer< OriginCrossGraphicsItem > mOriginCrossGraphicsItem
Definition: stroketextgraphicsitem.h:77
type_safe::constrained_type< QString, GraphicsLayerNameConstraint, GraphicsLayerNameVerifier > GraphicsLayerName
Definition: graphicslayername.h:78
The StrokeText class.
Definition: stroketext.h:119
QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexceptoverride
Definition: stroketextgraphicsitem.cpp:133
void updateLayer(const GraphicsLayerName &layerName) noexcept
Definition: stroketextgraphicsitem.cpp:119
StrokeText & getText() noexcept
Definition: stroketextgraphicsitem.h:58
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:227
The PrimitivePathGraphicsItem class.
Definition: primitivepathgraphicsitem.h:44
StrokeText & mText
Definition: stroketextgraphicsitem.h:75
~StrokeTextGraphicsItem() noexcept
Definition: stroketextgraphicsitem.cpp:67
QPainterPath shape() const noexceptoverride
Definition: stroketextgraphicsitem.cpp:74
The StrokeTextGraphicsItem class is the graphical representation of a librepcb::StrokeText.
Definition: stroketextgraphicsitem.h:48
The OriginCrossGraphicsItem class.
Definition: origincrossgraphicsitem.h:44
const IF_GraphicsLayerProvider & mLayerProvider
Definition: stroketextgraphicsitem.h:76