LibrePCB Developers Documentation
Loading...
Searching...
No Matches
sgi_text.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_SGI_TEXT_H
21#define LIBREPCB_EDITOR_SGI_TEXT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "sgi_symbol.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 TextGraphicsItem;
42
43/*******************************************************************************
44 * Class SGI_Text
45 ******************************************************************************/
46
50class SGI_Text final : public QGraphicsItemGroup {
51public:
52 // Constructors / Destructor
53 SGI_Text() = delete;
54 SGI_Text(const SGI_Text& other) = delete;
55 SGI_Text(SI_Text& text, std::weak_ptr<SGI_Symbol> symbolItem,
56 const IF_GraphicsLayerProvider& lp) noexcept;
57 virtual ~SGI_Text() noexcept;
58
59 // General Methods
60 SI_Text& getText() noexcept { return mText; }
61 const std::weak_ptr<SGI_Symbol>& getSymbolGraphicsItem() noexcept {
63 }
64
65 // Inherited from QGraphicsItem
66 virtual QPainterPath shape() const noexcept override;
67
68 // Operator Overloadings
69 SGI_Text& operator=(const SGI_Text& rhs) = delete;
70
71private: // Methods
72 void textEdited(const SI_Text& obj, SI_Text::Event event) noexcept;
74 SGI_Symbol::Event event) noexcept;
75 virtual QVariant itemChange(GraphicsItemChange change,
76 const QVariant& value) noexcept override;
77 void updateText() noexcept;
78 void updateAnchorLayer() noexcept;
79 void updateAnchorLine() noexcept;
80
81private: // Data
87
88 // Slots
89 SI_Text::OnEditedSlot mOnEditedSlot;
91};
92
93/*******************************************************************************
94 * End of File
95 ******************************************************************************/
96
97} // namespace editor
98} // namespace librepcb
99
100#endif
The SI_Text class represents a text label in a schematic.
Definition si_text.h:48
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition graphicslayer.h:111
The LineGraphicsItem class.
Definition linegraphicsitem.h:50
The SGI_Symbol class.
Definition sgi_symbol.h:52
The SGI_Text class.
Definition sgi_text.h:50
virtual ~SGI_Text() noexcept
Definition sgi_text.cpp:68
void updateText() noexcept
Definition sgi_text.cpp:138
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition sgi_text.cpp:80
SI_Text::OnEditedSlot mOnEditedSlot
Definition sgi_text.h:89
QScopedPointer< TextGraphicsItem > mTextGraphicsItem
Definition sgi_text.h:85
QScopedPointer< LineGraphicsItem > mAnchorGraphicsItem
Definition sgi_text.h:86
void updateAnchorLayer() noexcept
Definition sgi_text.cpp:143
virtual QPainterPath shape() const noexcept override
Definition sgi_text.cpp:75
void updateAnchorLine() noexcept
Definition sgi_text.cpp:153
const IF_GraphicsLayerProvider & mLayerProvider
Definition sgi_text.h:84
SGI_Text(const SGI_Text &other)=delete
SI_Text & getText() noexcept
Definition sgi_text.h:60
void symbolGraphicsItemEdited(const SGI_Symbol &obj, SGI_Symbol::Event event) noexcept
Definition sgi_text.cpp:121
const std::weak_ptr< SGI_Symbol > & getSymbolGraphicsItem() noexcept
Definition sgi_text.h:61
SI_Text & mText
Definition sgi_text.h:82
void textEdited(const SI_Text &obj, SI_Text::Event event) noexcept
Definition sgi_text.cpp:102
std::weak_ptr< SGI_Symbol > mSymbolGraphicsItem
Definition sgi_text.h:83
SGI_Symbol::OnEditedSlot mOnSymbolEditedSlot
Definition sgi_text.h:90
The TextGraphicsItem class is the graphical representation of a librepcb::Text.
Definition textgraphicsitem.h:49
Definition occmodel.cpp:76
Definition uuid.h:186