LibrePCB Developers Documentation
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_EDITOR_FOOTPRINTPADGRAPHICSITEM_H
21 #define LIBREPCB_EDITOR_FOOTPRINTPADGRAPHICSITEM_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 
29 #include <QtCore>
30 #include <QtWidgets>
31 
32 #include <memory>
33 
34 /*******************************************************************************
35  * Namespace / Forward Declarations
36  ******************************************************************************/
37 namespace librepcb {
38 namespace editor {
39 
40 class IF_GraphicsLayerProvider;
41 class PrimitiveFootprintPadGraphicsItem;
42 
43 /*******************************************************************************
44  * Class FootprintPadGraphicsItem
45  ******************************************************************************/
46 
50 class FootprintPadGraphicsItem final : public QGraphicsItemGroup {
51 public:
52  // Constructors / Destructor
53  FootprintPadGraphicsItem() = delete;
55  FootprintPadGraphicsItem(std::shared_ptr<FootprintPad> pad,
56  const IF_GraphicsLayerProvider& lp,
57  const PackagePadList* packagePadList,
58  QGraphicsItem* parent = nullptr) noexcept;
59  ~FootprintPadGraphicsItem() noexcept;
60 
61  // Getters
62  const std::shared_ptr<FootprintPad>& getPad() noexcept { return mPad; }
63 
64  // General Methods
65  void updateText() noexcept;
66 
67  // Inherited from QGraphicsItem
68  QPainterPath shape() const noexcept override;
69 
70  // Operator Overloadings
72  delete;
73 
74 private: // Methods
75  void padEdited(const FootprintPad& pad, FootprintPad::Event event) noexcept;
76  void packagePadListEdited(const PackagePadList& list, int index,
77  const std::shared_ptr<const PackagePad>& pad,
78  PackagePadList::Event event) noexcept;
79  virtual QVariant itemChange(GraphicsItemChange change,
80  const QVariant& value) noexcept override;
81  void updateLayer() noexcept;
82  void updateGeometries() noexcept;
83 
84 private: // Data
85  std::shared_ptr<FootprintPad> mPad;
87  QScopedPointer<PrimitiveFootprintPadGraphicsItem> mGraphicsItem;
88 
89  // Slots
92 };
93 
94 /*******************************************************************************
95  * End of File
96  ******************************************************************************/
97 
98 } // namespace editor
99 } // namespace librepcb
100 
101 #endif
std::shared_ptr< FootprintPad > mPad
Definition: footprintpadgraphicsitem.h:85
Slot< SerializableObjectList< PackagePad, PackagePadListNameProvider, OnEditedArgs... >, int, const std::shared_ptr< const PackagePad > &, Event > OnEditedSlot
Definition: serializableobjectlist.h:136
const PackagePadList * mPackagePadList
Definition: footprintpadgraphicsitem.h:86
QScopedPointer< PrimitiveFootprintPadGraphicsItem > mGraphicsItem
Definition: footprintpadgraphicsitem.h:87
~FootprintPadGraphicsItem() noexcept
Definition: footprintpadgraphicsitem.cpp:72
Definition: occmodel.cpp:76
void updateText() noexcept
Definition: footprintpadgraphicsitem.cpp:79
void updateLayer() noexcept
Definition: footprintpadgraphicsitem.cpp:160
FootprintPad::OnEditedSlot mOnPadEditedSlot
Definition: footprintpadgraphicsitem.h:90
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:54
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition: footprintpadgraphicsitem.cpp:99
void updateGeometries() noexcept
Definition: footprintpadgraphicsitem.cpp:165
void packagePadListEdited(const PackagePadList &list, int index, const std::shared_ptr< const PackagePad > &pad, PackagePadList::Event event) noexcept
Definition: footprintpadgraphicsitem.cpp:149
const std::shared_ptr< FootprintPad > & getPad() noexcept
Definition: footprintpadgraphicsitem.h:62
PackagePadList::OnEditedSlot mOnPackagePadsEditedSlot
Definition: footprintpadgraphicsitem.h:91
The FootprintPadGraphicsItem class.
Definition: footprintpadgraphicsitem.h:50
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:111
FootprintPadGraphicsItem & operator=(const FootprintPadGraphicsItem &rhs)=delete
void padEdited(const FootprintPad &pad, FootprintPad::Event event) noexcept
Definition: footprintpadgraphicsitem.cpp:111
Event
Definition: footprintpad.h:84
QPainterPath shape() const noexcept override
Definition: footprintpadgraphicsitem.cpp:94