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 ******************************************************************************/
37namespace librepcb {
38namespace editor {
39
40class IF_GraphicsLayerProvider;
41class PrimitiveFootprintPadGraphicsItem;
42
43/*******************************************************************************
44 * Class FootprintPadGraphicsItem
45 ******************************************************************************/
46
50class FootprintPadGraphicsItem final : public QGraphicsItemGroup {
51public:
52 // Constructors / Destructor
55 FootprintPadGraphicsItem(std::shared_ptr<FootprintPad> pad,
57 const PackagePadList* packagePadList,
58 QGraphicsItem* parent = nullptr) noexcept;
59 ~FootprintPadGraphicsItem() noexcept;
60
61 // Getters
62 FootprintPad& getObj() 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
74private: // 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
84private: // Data
85 std::shared_ptr<FootprintPad> mPad;
88
89 // Slots
92};
93
94/*******************************************************************************
95 * End of File
96 ******************************************************************************/
97
98} // namespace editor
99} // namespace librepcb
100
101#endif
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:55
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:47
The FootprintPadGraphicsItem class.
Definition: footprintpadgraphicsitem.h:50
void updateText() noexcept
Definition: footprintpadgraphicsitem.cpp:79
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition: footprintpadgraphicsitem.cpp:100
const PackagePadList * mPackagePadList
Definition: footprintpadgraphicsitem.h:86
void padEdited(const FootprintPad &pad, FootprintPad::Event event) noexcept
Definition: footprintpadgraphicsitem.cpp:112
void packagePadListEdited(const PackagePadList &list, int index, const std::shared_ptr< const PackagePad > &pad, PackagePadList::Event event) noexcept
Definition: footprintpadgraphicsitem.cpp:150
FootprintPadGraphicsItem(const FootprintPadGraphicsItem &other)=delete
std::shared_ptr< FootprintPad > mPad
Definition: footprintpadgraphicsitem.h:85
QPainterPath shape() const noexcept override
Definition: footprintpadgraphicsitem.cpp:95
FootprintPad & getObj() noexcept
Definition: footprintpadgraphicsitem.h:62
QScopedPointer< PrimitiveFootprintPadGraphicsItem > mGraphicsItem
Definition: footprintpadgraphicsitem.h:87
PackagePadList::OnEditedSlot mOnPackagePadsEditedSlot
Definition: footprintpadgraphicsitem.h:91
void updateGeometries() noexcept
Definition: footprintpadgraphicsitem.cpp:166
void updateLayer() noexcept
Definition: footprintpadgraphicsitem.cpp:161
FootprintPad::OnEditedSlot mOnPadEditedSlot
Definition: footprintpadgraphicsitem.h:90
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition: graphicslayer.h:111
The PrimitiveFootprintPadGraphicsItem class.
Definition: primitivefootprintpadgraphicsitem.h:56
Definition: occmodel.cpp:77