LibrePCB Developers Documentation
Loading...
Searching...
No Matches
bgi_pad.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_BGI_PAD_H
21#define LIBREPCB_EDITOR_BGI_PAD_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "bgi_device.h"
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33#include <memory>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class NetSignal;
41
42namespace editor {
43
44class GraphicsLayerList;
45class PrimitiveFootprintPadGraphicsItem;
46
47/*******************************************************************************
48 * Class BGI_Pad
49 ******************************************************************************/
50
54class BGI_Pad final : public QGraphicsItemGroup {
55 Q_DECLARE_TR_FUNCTIONS(BGI_Pad)
56
57public:
58 // Constructors / Destructor
59 BGI_Pad() = delete;
60 BGI_Pad(const BGI_Pad& other) = delete;
61 BGI_Pad(BI_Pad& pad, std::weak_ptr<BGI_Device> deviceItem,
62 const GraphicsLayerList& layers,
63 std::shared_ptr<const QSet<const NetSignal*>>
64 highlightedNetSignals) noexcept;
65 virtual ~BGI_Pad() noexcept;
66
67 // General Methods
68 BI_Pad& getPad() noexcept { return mPad; }
69 const std::weak_ptr<BGI_Device>& getDeviceGraphicsItem() noexcept {
71 }
72 void updateHighlightedNetSignals() noexcept;
73
74 // Inherited from QGraphicsItem
75 QPainterPath shape() const noexcept override;
76
77 // Operator Overloadings
78 BGI_Pad& operator=(const BGI_Pad& rhs) = delete;
79
80private: // Methods
81 void padEdited(const BI_Pad& obj, BI_Pad::Event event) noexcept;
83 BGI_Device::Event event) noexcept;
84 virtual QVariant itemChange(GraphicsItemChange change,
85 const QVariant& value) noexcept override;
86 void updateLayer() noexcept;
87 void updateToolTip() noexcept;
88 void updateHightlighted(bool selected) noexcept;
89
90private: // Data
93 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
95
96 // Slots
97 BI_Pad::OnEditedSlot mOnPadEditedSlot;
99};
100
101/*******************************************************************************
102 * End of File
103 ******************************************************************************/
104
105} // namespace editor
106} // namespace librepcb
107
108#endif
A pad in a board (either standalone or from a footprint)
Definition bi_pad.h:49
The NetSignal class.
Definition netsignal.h:50
The BGI_Device class.
Definition bgi_device.h:58
The BGI_Pad class.
Definition bgi_pad.h:54
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition bgi_pad.h:93
void updateHightlighted(bool selected) noexcept
Definition bgi_pad.cpp:200
BI_Pad::OnEditedSlot mOnPadEditedSlot
Definition bgi_pad.h:97
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition bgi_pad.cpp:100
BI_Pad & getPad() noexcept
Definition bgi_pad.h:68
void deviceGraphicsItemEdited(const BGI_Device &obj, BGI_Device::Event event) noexcept
Definition bgi_pad.cpp:156
void updateToolTip() noexcept
Definition bgi_pad.cpp:176
const std::weak_ptr< BGI_Device > & getDeviceGraphicsItem() noexcept
Definition bgi_pad.h:69
QPainterPath shape() const noexcept override
Definition bgi_pad.cpp:95
virtual ~BGI_Pad() noexcept
Definition bgi_pad.cpp:80
std::weak_ptr< BGI_Device > mDeviceGraphicsItem
Definition bgi_pad.h:92
QScopedPointer< PrimitiveFootprintPadGraphicsItem > mGraphicsItem
Definition bgi_pad.h:94
BGI_Pad(const BGI_Pad &other)=delete
BGI_Device::OnEditedSlot mOnDeviceEditedSlot
Definition bgi_pad.h:98
void padEdited(const BI_Pad &obj, BI_Pad::Event event) noexcept
Definition bgi_pad.cpp:112
void updateLayer() noexcept
Definition bgi_pad.cpp:163
void updateHighlightedNetSignals() noexcept
Definition bgi_pad.cpp:87
BI_Pad & mPad
Definition bgi_pad.h:91
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
The PrimitiveFootprintPadGraphicsItem class.
Definition primitivefootprintpadgraphicsitem.h:57
Definition occmodel.cpp:77
Definition uuid.h:186