LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_PROJECT_SGI_SYMBOLPIN_H
21 #define LIBREPCB_PROJECT_SGI_SYMBOLPIN_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "sgi_base.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class GraphicsLayer;
37 
38 namespace library {
39 class SymbolPin;
40 }
41 
42 namespace project {
43 
44 class SI_SymbolPin;
45 
46 /*******************************************************************************
47  * Class SGI_SymbolPin
48  ******************************************************************************/
49 
53 class SGI_SymbolPin final : public SGI_Base {
54 public:
55  // Constructors / Destructor
56  explicit SGI_SymbolPin(SI_SymbolPin& pin) noexcept;
57  ~SGI_SymbolPin() noexcept;
58 
59  // General Methods
60  void updateCacheAndRepaint() noexcept;
61 
62  // Inherited from QGraphicsItem
63  QRectF boundingRect() const noexcept { return mBoundingRect; }
64  QPainterPath shape() const noexcept { return mShape; }
65  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
66  QWidget* widget = 0);
67 
68 private:
69  // make some methods inaccessible...
70  SGI_SymbolPin() = delete;
71  SGI_SymbolPin(const SGI_SymbolPin& other) = delete;
72  SGI_SymbolPin& operator=(const SGI_SymbolPin& rhs) = delete;
73 
74  // Private Methods
75  GraphicsLayer* getLayer(const QString& name) const noexcept;
76 
77  // General Attributes
80  QFont mFont;
81  qreal mRadiusPx;
82 
83  // Cached Attributes
86  QStaticText mStaticText;
87  bool mRotate180;
88  bool mMirrored;
89  QRectF mBoundingRect;
90  QPointF mTextOrigin;
92  QPainterPath mShape;
93 };
94 
95 /*******************************************************************************
96  * End of File
97  ******************************************************************************/
98 
99 } // namespace project
100 } // namespace librepcb
101 
102 #endif // LIBREPCB_PROJECT_SGI_SYMBOLPIN_H
QRectF mTextBoundingRect
Definition: sgi_symbolpin.h:91
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition: graphicslayer.h:50
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: sgi_symbolpin.cpp:139
~SGI_SymbolPin() noexcept
Definition: sgi_symbolpin.cpp:72
void updateCacheAndRepaint() noexcept
Definition: sgi_symbolpin.cpp:79
bool mIsVisibleJunction
Definition: sgi_symbolpin.h:84
SI_SymbolPin & mPin
Definition: sgi_symbolpin.h:78
GraphicsLayer * getLayer(const QString &name) const noexcept
Definition: sgi_symbolpin.cpp:246
QPointF mTextOrigin
Definition: sgi_symbolpin.h:90
QStaticText mStaticText
Definition: sgi_symbolpin.h:86
QPainterPath mShape
Definition: sgi_symbolpin.h:92
The SI_SymbolPin class.
Definition: si_symbolpin.h:58
QPainterPath shape() const noexcept
Definition: sgi_symbolpin.h:64
The Schematic Graphics Item Base (SGI_Base) class.
Definition: sgi_base.h:44
SGI_SymbolPin & operator=(const SGI_SymbolPin &rhs)=delete
GraphicsLayer * mJunctionLayer
Definition: sgi_symbolpin.h:85
qreal mRadiusPx
Definition: sgi_symbolpin.h:81
QFont mFont
Definition: sgi_symbolpin.h:80
The SymbolPin class represents one pin of a symbol.
Definition: symbolpin.h:54
QRectF boundingRect() const noexcept
Definition: sgi_symbolpin.h:63
const library::SymbolPin & mLibPin
Definition: sgi_symbolpin.h:79
bool mRotate180
Definition: sgi_symbolpin.h:87
QRectF mBoundingRect
Definition: sgi_symbolpin.h:89
bool mMirrored
Definition: sgi_symbolpin.h:88
The SGI_SymbolPin class.
Definition: sgi_symbolpin.h:53