LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
footprintpadgraphicsitem.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_LIBRARY_FOOTPRINTPADGRAPHICSITEM_H
21 #define LIBREPCB_LIBRARY_FOOTPRINTPADGRAPHICSITEM_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class IF_GraphicsLayerProvider;
37 class PrimitivePathGraphicsItem;
38 // class PrimitiveTextGraphicsItem;
39 
40 namespace library {
41 
42 class FootprintPad;
43 
44 /*******************************************************************************
45  * Class FootprintPadGraphicsItem
46  ******************************************************************************/
47 
54 class FootprintPadGraphicsItem final : public QGraphicsItem {
55 public:
56  // Constructors / Destructor
57  FootprintPadGraphicsItem() = delete;
60  const IF_GraphicsLayerProvider& lp,
61  QGraphicsItem* parent = nullptr) noexcept;
62  ~FootprintPadGraphicsItem() noexcept;
63 
64  // Getters
65  FootprintPad& getPad() noexcept { return mPad; }
66 
67  // Setters
68  void setPosition(const Point& pos) noexcept;
69  void setRotation(const Angle& rot) noexcept;
70  void setShape(const QPainterPath& shape) noexcept;
71  void setLayerName(const QString& name) noexcept;
72  // void setName(const QString& name) noexcept;
73  void setSelected(bool selected) noexcept;
74 
75  // Inherited from QGraphicsItem
76  QRectF boundingRect() const noexcept override { return QRectF(); }
77  QPainterPath shape() const noexcept override;
78  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
79  QWidget* widget = 0) noexcept override;
80 
81  // Operator Overloadings
82  FootprintPadGraphicsItem& operator=(const FootprintPadGraphicsItem& rhs) =
83  delete;
84 
85 private: // Methods
86  void updateShape() noexcept;
87 
88 private: // Data
92  // QScopedPointer<PrimitiveTextGraphicsItem> mTextGraphicsItem;
93 };
94 
95 /*******************************************************************************
96  * End of File
97  ******************************************************************************/
98 
99 } // namespace library
100 } // namespace librepcb
101 
102 #endif // LIBREPCB_LIBRARY_FOOTPRINTPADGRAPHICSITEM_H
const IF_GraphicsLayerProvider & mLayerProvider
Definition: footprintpadgraphicsitem.h:90
void setRotation(const Angle &rot) noexcept
Definition: footprintpadgraphicsitem.cpp:82
QRectF boundingRect() const noexceptoverride
Definition: footprintpadgraphicsitem.h:76
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:81
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:250
The PrimitivePathGraphicsItem class.
Definition: primitivepathgraphicsitem.h:47
void setShape(const QPainterPath &shape) noexcept
Definition: footprintpadgraphicsitem.cpp:86
~FootprintPadGraphicsItem() noexcept
Definition: footprintpadgraphicsitem.cpp:70
void setSelected(bool selected) noexcept
Definition: footprintpadgraphicsitem.cpp:101
void setPosition(const Point &pos) noexcept
Definition: footprintpadgraphicsitem.cpp:78
QPainterPath shape() const noexceptoverride
Definition: footprintpadgraphicsitem.cpp:111
void setLayerName(const QString &name) noexcept
Definition: footprintpadgraphicsitem.cpp:91
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
FootprintPad & mPad
Definition: footprintpadgraphicsitem.h:89
QScopedPointer< PrimitivePathGraphicsItem > mPathGraphicsItem
Definition: footprintpadgraphicsitem.h:91
FootprintPad & getPad() noexcept
Definition: footprintpadgraphicsitem.h:65
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:52
The FootprintPadGraphicsItem class.
Definition: footprintpadgraphicsitem.h:54
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexceptoverride
Definition: footprintpadgraphicsitem.cpp:115