LibrePCB Developers Documentation
bgi_stroketext.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_EDITOR_BGI_STROKETEXT_H
21#define LIBREPCB_EDITOR_BGI_STROKETEXT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "bgi_device.h"
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39class IF_GraphicsLayerProvider;
40class LineGraphicsItem;
41class OriginCrossGraphicsItem;
42class PrimitivePathGraphicsItem;
43
44/*******************************************************************************
45 * Class BGI_StrokeText
46 ******************************************************************************/
47
51class BGI_StrokeText final : public QGraphicsItemGroup {
52public:
53 // Constructors / Destructor
54 BGI_StrokeText() = delete;
55 BGI_StrokeText(const BGI_StrokeText& other) = delete;
56 BGI_StrokeText(BI_StrokeText& text, std::weak_ptr<BGI_Device> deviceItem,
57 const IF_GraphicsLayerProvider& lp) noexcept;
58 virtual ~BGI_StrokeText() noexcept;
59
60 // General Methods
61 BI_StrokeText& getStrokeText() noexcept { return mText; }
62 const std::weak_ptr<BGI_Device>& getDeviceGraphicsItem() noexcept {
64 }
65
66 // Inherited from QGraphicsItem
67 virtual QPainterPath shape() const noexcept override;
68
69 // Operator Overloadings
70 BGI_StrokeText& operator=(const BGI_StrokeText& rhs) = delete;
71
72private: // Methods
73 void strokeTextEdited(const BI_StrokeText& obj,
74 BI_StrokeText::Event event) noexcept;
76 BGI_Device::Event event) noexcept;
77 virtual QVariant itemChange(GraphicsItemChange change,
78 const QVariant& value) noexcept override;
79 void updatePosition() noexcept;
80 void updateTransform() noexcept;
81 void updateLayer() noexcept;
82 void updateStrokeWidth() noexcept;
83 void updatePaths() noexcept;
84 void updateAnchorLayer() noexcept;
85 void updateAnchorLine() noexcept;
86
87private: // Data
94
95 // Slots
98};
99
100/*******************************************************************************
101 * End of File
102 ******************************************************************************/
103
104} // namespace editor
105} // namespace librepcb
106
107#endif
The BI_StrokeText class.
Definition: bi_stroketext.h:49
The BGI_Device class.
Definition: bgi_device.h:57
The BGI_StrokeText class.
Definition: bgi_stroketext.h:51
QScopedPointer< PrimitivePathGraphicsItem > mPathGraphicsItem
Definition: bgi_stroketext.h:91
QScopedPointer< OriginCrossGraphicsItem > mOriginCrossGraphicsItem
Definition: bgi_stroketext.h:92
void updatePaths() noexcept
Definition: bgi_stroketext.cpp:195
void updatePosition() noexcept
Definition: bgi_stroketext.cpp:160
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition: bgi_stroketext.cpp:90
void strokeTextEdited(const BI_StrokeText &obj, BI_StrokeText::Event event) noexcept
Definition: bgi_stroketext.cpp:113
void deviceGraphicsItemEdited(const BGI_Device &obj, BGI_Device::Event event) noexcept
Definition: bgi_stroketext.cpp:143
BI_StrokeText & mText
Definition: bgi_stroketext.h:88
BI_StrokeText & getStrokeText() noexcept
Definition: bgi_stroketext.h:61
const std::weak_ptr< BGI_Device > & getDeviceGraphicsItem() noexcept
Definition: bgi_stroketext.h:62
QScopedPointer< LineGraphicsItem > mAnchorGraphicsItem
Definition: bgi_stroketext.h:93
BGI_StrokeText(const BGI_StrokeText &other)=delete
void updateAnchorLayer() noexcept
Definition: bgi_stroketext.cpp:200
virtual QPainterPath shape() const noexcept override
Definition: bgi_stroketext.cpp:84
virtual ~BGI_StrokeText() noexcept
Definition: bgi_stroketext.cpp:77
void updateStrokeWidth() noexcept
Definition: bgi_stroketext.cpp:191
void updateAnchorLine() noexcept
Definition: bgi_stroketext.cpp:210
const IF_GraphicsLayerProvider & mLayerProvider
Definition: bgi_stroketext.h:90
std::weak_ptr< BGI_Device > mDeviceGraphicsItem
Definition: bgi_stroketext.h:89
void updateTransform() noexcept
Definition: bgi_stroketext.cpp:164
BI_StrokeText::OnEditedSlot mOnEditedSlot
Definition: bgi_stroketext.h:96
BGI_Device::OnEditedSlot mOnDeviceEditedSlot
Definition: bgi_stroketext.h:97
void updateLayer() noexcept
Definition: bgi_stroketext.cpp:171
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition: graphicslayer.h:111
The LineGraphicsItem class.
Definition: linegraphicsitem.h:50
The OriginCrossGraphicsItem class.
Definition: origincrossgraphicsitem.h:50
The PrimitivePathGraphicsItem class.
Definition: primitivepathgraphicsitem.h:50
Definition: occmodel.cpp:77