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 
51 class FootprintPadGraphicsItem final : public QGraphicsItem {
52 public:
53  // Constructors / Destructor
54  FootprintPadGraphicsItem() = delete;
57  const IF_GraphicsLayerProvider& lp,
58  QGraphicsItem* parent = nullptr) noexcept;
59  ~FootprintPadGraphicsItem() noexcept;
60 
61  // Getters
62  FootprintPad& getPad() noexcept { return mPad; }
63 
64  // Setters
65  void setPosition(const Point& pos) noexcept;
66  void setRotation(const Angle& rot) noexcept;
67  void setShape(const QPainterPath& shape) noexcept;
68  void setLayerName(const QString& name) noexcept;
69  // void setName(const QString& name) noexcept;
70  void setSelected(bool selected) noexcept;
71 
72  // Inherited from QGraphicsItem
73  QRectF boundingRect() const noexcept override { return QRectF(); }
74  QPainterPath shape() const noexcept override;
75  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
76  QWidget* widget = 0) noexcept override;
77 
78  // Operator Overloadings
79  FootprintPadGraphicsItem& operator=(const FootprintPadGraphicsItem& rhs) =
80  delete;
81 
82 private: // Methods
83  void updateShape() noexcept;
84 
85 private: // Data
89  // QScopedPointer<PrimitiveTextGraphicsItem> mTextGraphicsItem;
90 };
91 
92 /*******************************************************************************
93  * End of File
94  ******************************************************************************/
95 
96 } // namespace library
97 } // namespace librepcb
98 
99 #endif // LIBREPCB_LIBRARY_FOOTPRINTPADGRAPHICSITEM_H
const IF_GraphicsLayerProvider & mLayerProvider
Definition: footprintpadgraphicsitem.h:87
void setRotation(const Angle &rot) noexcept
Definition: footprintpadgraphicsitem.cpp:82
QRectF boundingRect() const noexceptoverride
Definition: footprintpadgraphicsitem.h:73
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:227
The PrimitivePathGraphicsItem class.
Definition: primitivepathgraphicsitem.h:44
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:78
FootprintPad & mPad
Definition: footprintpadgraphicsitem.h:86
QScopedPointer< PrimitivePathGraphicsItem > mPathGraphicsItem
Definition: footprintpadgraphicsitem.h:88
FootprintPad & getPad() noexcept
Definition: footprintpadgraphicsitem.h:62
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:52
The FootprintPadGraphicsItem class.
Definition: footprintpadgraphicsitem.h:51
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexceptoverride
Definition: footprintpadgraphicsitem.cpp:115