LibrePCB Developers Documentation
sgi_symbolpin.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_SYMBOLPIN_H
21#define LIBREPCB_EDITOR_SGI_SYMBOLPIN_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "sgi_symbol.h"
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33#include <memory>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39namespace editor {
40
41class IF_GraphicsLayerProvider;
42class LineGraphicsItem;
43class PrimitiveCircleGraphicsItem;
44class PrimitiveTextGraphicsItem;
45
46/*******************************************************************************
47 * Class SGI_SymbolPin
48 ******************************************************************************/
49
53class SGI_SymbolPin final : public QGraphicsItemGroup {
54 Q_DECLARE_TR_FUNCTIONS(SGI_SymbolPin)
55
56public:
57 // Constructors / Destructor
58 SGI_SymbolPin() = delete;
59 SGI_SymbolPin(const SGI_SymbolPin& other) = delete;
60 SGI_SymbolPin(SI_SymbolPin& pin, std::weak_ptr<SGI_Symbol> symbolItem,
62 std::shared_ptr<const QSet<const NetSignal*>>
63 highlightedNetSignals) noexcept;
64 virtual ~SGI_SymbolPin() noexcept;
65
66 // General Methods
67 SI_SymbolPin& getPin() noexcept { return mPin; }
68 const std::weak_ptr<SGI_Symbol>& getSymbolGraphicsItem() noexcept {
70 }
71 void updateHighlightedState() noexcept;
72
73 // Inherited from QGraphicsItem
74 QPainterPath shape() const noexcept override;
75
76 // Operator Overloadings
77 SGI_SymbolPin& operator=(const SGI_SymbolPin& rhs) = delete;
78
79private: // Methods
80 void pinEdited(const SI_SymbolPin& obj, SI_SymbolPin::Event event) noexcept;
82 SGI_Symbol::Event event) noexcept;
83 virtual QVariant itemChange(GraphicsItemChange change,
84 const QVariant& value) noexcept override;
85 void updatePosition() noexcept;
86 void updateRotation() noexcept;
87 void updateJunction() noexcept;
88 void updateName() noexcept;
89 void updateNumbers() noexcept;
90 void updateNumbersPosition() noexcept;
91 void updateNumbersAlignment() noexcept;
92 void updateToolTip() noexcept;
93
94private: // Data
98 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
103
104 // Slots
107};
108
109/*******************************************************************************
110 * End of File
111 ******************************************************************************/
112
113} // namespace editor
114} // namespace librepcb
115
116#endif
The NetSignal class.
Definition: netsignal.h:50
The SI_SymbolPin class.
Definition: si_symbolpin.h:52
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition: graphicslayer.h:111
The LineGraphicsItem class.
Definition: linegraphicsitem.h:50
The PrimitiveCircleGraphicsItem class.
Definition: primitivecirclegraphicsitem.h:49
The PrimitiveTextGraphicsItem class is the graphical representation of a text.
Definition: primitivetextgraphicsitem.h:52
The SGI_Symbol class.
Definition: sgi_symbol.h:52
The SGI_SymbolPin class.
Definition: sgi_symbolpin.h:53
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition: sgi_symbolpin.h:98
QScopedPointer< PrimitiveTextGraphicsItem > mNumbersGraphicsItem
Definition: sgi_symbolpin.h:102
void updatePosition() noexcept
Definition: sgi_symbolpin.cpp:203
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition: sgi_symbolpin.cpp:145
QScopedPointer< PrimitiveCircleGraphicsItem > mCircleGraphicsItem
Definition: sgi_symbolpin.h:99
SGI_SymbolPin(const SGI_SymbolPin &other)=delete
void updateToolTip() noexcept
Definition: sgi_symbolpin.cpp:268
void updateRotation() noexcept
Definition: sgi_symbolpin.cpp:207
QPainterPath shape() const noexcept override
Definition: sgi_symbolpin.cpp:140
SI_SymbolPin & getPin() noexcept
Definition: sgi_symbolpin.h:67
void updateJunction() noexcept
Definition: sgi_symbolpin.cpp:230
void pinEdited(const SI_SymbolPin &obj, SI_SymbolPin::Event event) noexcept
Definition: sgi_symbolpin.cpp:158
const IF_GraphicsLayerProvider & mLayerProvider
Definition: sgi_symbolpin.h:97
QScopedPointer< LineGraphicsItem > mLineGraphicsItem
Definition: sgi_symbolpin.h:100
void updateName() noexcept
Definition: sgi_symbolpin.cpp:247
void updateHighlightedState() noexcept
Definition: sgi_symbolpin.cpp:127
SI_SymbolPin & mPin
Definition: sgi_symbolpin.h:95
void updateNumbers() noexcept
Definition: sgi_symbolpin.cpp:252
virtual ~SGI_SymbolPin() noexcept
Definition: sgi_symbolpin.cpp:120
void updateNumbersAlignment() noexcept
Definition: sgi_symbolpin.cpp:263
void symbolGraphicsItemEdited(const SGI_Symbol &obj, SGI_Symbol::Event event) noexcept
Definition: sgi_symbolpin.cpp:196
const std::weak_ptr< SGI_Symbol > & getSymbolGraphicsItem() noexcept
Definition: sgi_symbolpin.h:68
SI_SymbolPin::OnEditedSlot mOnPinEditedSlot
Definition: sgi_symbolpin.h:105
std::weak_ptr< SGI_Symbol > mSymbolGraphicsItem
Definition: sgi_symbolpin.h:96
QScopedPointer< PrimitiveTextGraphicsItem > mNameGraphicsItem
Definition: sgi_symbolpin.h:101
SGI_Symbol::OnEditedSlot mOnSymbolEditedSlot
Definition: sgi_symbolpin.h:106
void updateNumbersPosition() noexcept
Definition: sgi_symbolpin.cpp:257
Definition: occmodel.cpp:77