LibrePCB Developers Documentation
Loading...
Searching...
No Matches
sgi_symbol.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_SYMBOL_H
21#define LIBREPCB_EDITOR_SGI_SYMBOL_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36class Point;
37
38namespace editor {
39
40class CircleGraphicsItem;
41class IF_GraphicsLayerProvider;
42class OriginCrossGraphicsItem;
43class PolygonGraphicsItem;
44
45/*******************************************************************************
46 * Class SGI_Symbol
47 ******************************************************************************/
48
52class SGI_Symbol final : public QGraphicsItemGroup {
53public:
54 // Signals
55 enum class Event {
58 };
61
62 // Constructors / Destructor
63 SGI_Symbol() = delete;
64 SGI_Symbol(const SGI_Symbol& other) = delete;
65 SGI_Symbol(SI_Symbol& symbol, const IF_GraphicsLayerProvider& lp) noexcept;
66 virtual ~SGI_Symbol() noexcept;
67
68 // General Methods
69 SI_Symbol& getSymbol() noexcept { return mSymbol; }
70
71 // Inherited from QGraphicsItem
72 QPainterPath shape() const noexcept override { return mShape; }
73
74 // Operator Overloadings
75 SGI_Symbol& operator=(const SGI_Symbol& rhs) = delete;
76
77private: // Methods
78 void symbolEdited(const SI_Symbol& obj, SI_Symbol::Event event) noexcept;
79 void updatePosition() noexcept;
80 void updateRotationAndMirrored() noexcept;
81 virtual QVariant itemChange(GraphicsItemChange change,
82 const QVariant& value) noexcept override;
83
84private: // Data
89 QPainterPath mShape;
90
91 // Slots
93};
94
95/*******************************************************************************
96 * End of File
97 ******************************************************************************/
98
99} // namespace editor
100} // namespace librepcb
101
102#endif
The SI_Symbol class.
Definition si_symbol.h:54
Event
Definition si_symbol.h:59
The Signal class is used to emit signals on non-QObject derived classes.
Definition signalslot.h:65
The Slot class is used to receive signals from non-QObject derived classes.
Definition signalslot.h:170
The CircleGraphicsItem class.
Definition circlegraphicsitem.h:48
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition graphicslayer.h:111
The OriginCrossGraphicsItem class.
Definition origincrossgraphicsitem.h:50
The PolygonGraphicsItem class.
Definition polygongraphicsitem.h:48
The SGI_Symbol class.
Definition sgi_symbol.h:52
std::shared_ptr< OriginCrossGraphicsItem > mOriginCrossGraphicsItem
Definition sgi_symbol.h:86
SI_Symbol::OnEditedSlot mOnEditedSlot
Definition sgi_symbol.h:92
void updatePosition() noexcept
Definition sgi_symbol.cpp:123
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition sgi_symbol.cpp:135
QPainterPath mShape
Definition sgi_symbol.h:89
Event
Definition sgi_symbol.h:55
virtual ~SGI_Symbol() noexcept
Definition sgi_symbol.cpp:98
Signal< SGI_Symbol, Event > onEdited
Definition sgi_symbol.h:59
QPainterPath shape() const noexcept override
Definition sgi_symbol.h:72
void symbolEdited(const SI_Symbol &obj, SI_Symbol::Event event) noexcept
Definition sgi_symbol.cpp:105
SGI_Symbol & operator=(const SGI_Symbol &rhs)=delete
void updateRotationAndMirrored() noexcept
Definition sgi_symbol.cpp:128
SGI_Symbol(const SGI_Symbol &other)=delete
QVector< std::shared_ptr< CircleGraphicsItem > > mCircleGraphicsItems
Definition sgi_symbol.h:87
SI_Symbol & mSymbol
Definition sgi_symbol.h:85
SI_Symbol & getSymbol() noexcept
Definition sgi_symbol.h:69
QVector< std::shared_ptr< PolygonGraphicsItem > > mPolygonGraphicsItems
Definition sgi_symbol.h:88
Slot< SGI_Symbol, Event > OnEditedSlot
Definition sgi_symbol.h:60
Definition occmodel.cpp:76
Definition uuid.h:186