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 GraphicsLayerList;
42class ImageGraphicsItem;
43class OriginCrossGraphicsItem;
44class PolygonGraphicsItem;
45
46/*******************************************************************************
47 * Class SGI_Symbol
48 ******************************************************************************/
49
53class SGI_Symbol final : public QGraphicsItemGroup {
54public:
55 // Signals
56 enum class Event {
59 };
62
63 // Constructors / Destructor
64 SGI_Symbol() = delete;
65 SGI_Symbol(const SGI_Symbol& other) = delete;
66 SGI_Symbol(SI_Symbol& symbol, const GraphicsLayerList& layers) noexcept;
67 virtual ~SGI_Symbol() noexcept;
68
69 // General Methods
70 SI_Symbol& getSymbol() noexcept { return mSymbol; }
71
72 // Inherited from QGraphicsItem
73 QPainterPath shape() const noexcept override { return mShape; }
74
75 // Operator Overloadings
76 SGI_Symbol& operator=(const SGI_Symbol& rhs) = delete;
77
78private: // Methods
79 void symbolEdited(const SI_Symbol& obj, SI_Symbol::Event event) noexcept;
80 void updatePosition() noexcept;
81 void updateRotationAndMirrored() noexcept;
82 virtual QVariant itemChange(GraphicsItemChange change,
83 const QVariant& value) noexcept override;
84
85private: // Data
91 QPainterPath mShape;
92
93 // Slots
95};
96
97/*******************************************************************************
98 * End of File
99 ******************************************************************************/
100
101} // namespace editor
102} // namespace librepcb
103
104#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 GraphicsLayerList class.
Definition graphicslayerlist.h:48
The ImageGraphicsItem class is the graphical representation of a librepcb::Image.
Definition imagegraphicsitem.h:52
The OriginCrossGraphicsItem class.
Definition origincrossgraphicsitem.h:50
The PolygonGraphicsItem class.
Definition polygongraphicsitem.h:48
The SGI_Symbol class.
Definition sgi_symbol.h:53
std::shared_ptr< OriginCrossGraphicsItem > mOriginCrossGraphicsItem
Definition sgi_symbol.h:87
SI_Symbol::OnEditedSlot mOnEditedSlot
Definition sgi_symbol.h:94
void updatePosition() noexcept
Definition sgi_symbol.cpp:135
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition sgi_symbol.cpp:147
QPainterPath mShape
Definition sgi_symbol.h:91
Event
Definition sgi_symbol.h:56
virtual ~SGI_Symbol() noexcept
Definition sgi_symbol.cpp:110
Signal< SGI_Symbol, Event > onEdited
Definition sgi_symbol.h:60
QPainterPath shape() const noexcept override
Definition sgi_symbol.h:73
void symbolEdited(const SI_Symbol &obj, SI_Symbol::Event event) noexcept
Definition sgi_symbol.cpp:117
QVector< std::shared_ptr< ImageGraphicsItem > > mImageGraphicsItems
Definition sgi_symbol.h:90
SGI_Symbol & operator=(const SGI_Symbol &rhs)=delete
void updateRotationAndMirrored() noexcept
Definition sgi_symbol.cpp:140
SGI_Symbol(const SGI_Symbol &other)=delete
QVector< std::shared_ptr< CircleGraphicsItem > > mCircleGraphicsItems
Definition sgi_symbol.h:88
SI_Symbol & mSymbol
Definition sgi_symbol.h:86
SI_Symbol & getSymbol() noexcept
Definition sgi_symbol.h:70
QVector< std::shared_ptr< PolygonGraphicsItem > > mPolygonGraphicsItems
Definition sgi_symbol.h:89
Slot< SGI_Symbol, Event > OnEditedSlot
Definition sgi_symbol.h:61
Definition occmodel.cpp:77
Definition uuid.h:186