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  ******************************************************************************/
26 #include "../pkg/packagepad.h"
27 
29 
30 #include <QtCore>
31 #include <QtWidgets>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 
38 class IF_GraphicsLayerProvider;
39 class PrimitivePathGraphicsItem;
40 class PrimitiveTextGraphicsItem;
41 
42 namespace library {
43 
44 class FootprintPad;
45 
46 /*******************************************************************************
47  * Class FootprintPadGraphicsItem
48  ******************************************************************************/
49 
53 class FootprintPadGraphicsItem final : public QGraphicsItem {
54 public:
55  // Constructors / Destructor
56  FootprintPadGraphicsItem() = delete;
59  const IF_GraphicsLayerProvider& lp,
60  const PackagePadList* packagePadList,
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 setPackagePadUuid(const Uuid& uuid) 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 packagePadListEdited(const PackagePadList& list, int index,
87  const std::shared_ptr<const PackagePad>& pad,
88  PackagePadList::Event event) noexcept;
89  void updateTextHeight() noexcept;
90 
91 private: // Data
97 
98  // Slots
100 };
101 
102 /*******************************************************************************
103  * End of File
104  ******************************************************************************/
105 
106 } // namespace library
107 } // namespace librepcb
108 
109 #endif // LIBREPCB_LIBRARY_FOOTPRINTPADGRAPHICSITEM_H
void updateTextHeight() noexcept
Definition: footprintpadgraphicsitem.cpp:156
void setPackagePadUuid(const Uuid &uuid) noexcept
Definition: footprintpadgraphicsitem.cpp:108
const IF_GraphicsLayerProvider & mLayerProvider
Definition: footprintpadgraphicsitem.h:93
void setRotation(const Angle &rot) noexcept
Definition: footprintpadgraphicsitem.cpp:94
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: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:98
~FootprintPadGraphicsItem() noexcept
Definition: footprintpadgraphicsitem.cpp:82
void setSelected(bool selected) noexcept
Definition: footprintpadgraphicsitem.cpp:119
void setPosition(const Point &pos) noexcept
Definition: footprintpadgraphicsitem.cpp:90
void packagePadListEdited(const PackagePadList &list, int index, const std::shared_ptr< const PackagePad > &pad, PackagePadList::Event event) noexcept
Definition: footprintpadgraphicsitem.cpp:145
QPainterPath shape() const noexceptoverride
Definition: footprintpadgraphicsitem.cpp:129
void setLayerName(const QString &name) noexcept
Definition: footprintpadgraphicsitem.cpp:103
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:92
QScopedPointer< PrimitiveTextGraphicsItem > mTextGraphicsItem
Definition: footprintpadgraphicsitem.h:96
QScopedPointer< PrimitivePathGraphicsItem > mPathGraphicsItem
Definition: footprintpadgraphicsitem.h:95
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:53
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The PrimitiveTextGraphicsItem class is the graphical representation of a text.
Definition: primitivetextgraphicsitem.h:46
PackagePadList::OnEditedSlot mOnPadsEditedSlot
Definition: footprintpadgraphicsitem.h:99
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:51
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexceptoverride
Definition: footprintpadgraphicsitem.cpp:133
const PackagePadList * mPackagePadList
Definition: footprintpadgraphicsitem.h:94