LibrePCB Developers Documentation
holegraphicsitem.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_HOLEGRAPHICSITEM_H
21 #define LIBREPCB_EDITOR_HOLEGRAPHICSITEM_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace editor {
36 
37 class IF_GraphicsLayerProvider;
38 class PrimitiveHoleGraphicsItem;
39 
40 /*******************************************************************************
41  * Class HoleGraphicsItem
42  ******************************************************************************/
43 
48 class HoleGraphicsItem final : public QGraphicsItemGroup {
49 public:
50  // Constructors / Destructor
51  HoleGraphicsItem() = delete;
52  HoleGraphicsItem(const HoleGraphicsItem& other) = delete;
54  bool originCrossesVisible,
55  QGraphicsItem* parent = nullptr) noexcept;
56  virtual ~HoleGraphicsItem() noexcept;
57 
58  // Getters
59  Hole& getHole() noexcept { return mHole; }
60 
61  // Inherited from QGraphicsItem
62  QPainterPath shape() const noexcept override;
63 
64  // Operator Overloadings
65  HoleGraphicsItem& operator=(const HoleGraphicsItem& rhs) = delete;
66 
67 private: // Methods
68  void holeEdited(const Hole& hole, Hole::Event event) noexcept;
69  QVariant itemChange(GraphicsItemChange change,
70  const QVariant& value) noexcept override;
71  void updateHole() noexcept;
72 
73 private: // Data
75  QScopedPointer<PrimitiveHoleGraphicsItem> mGraphicsItem;
76 
77  // Slots
79 };
80 
81 /*******************************************************************************
82  * End of File
83  ******************************************************************************/
84 
85 } // namespace editor
86 } // namespace librepcb
87 
88 #endif
Definition: occmodel.cpp:77
Hole::OnEditedSlot mOnEditedSlot
Definition: holegraphicsitem.h:78
The Hole class.
Definition: hole.h:45
Hole & mHole
Definition: holegraphicsitem.h:74
virtual ~HoleGraphicsItem() noexcept
Definition: holegraphicsitem.cpp:59
The HoleGraphicsItem class is the graphical representation of a librepcb::Hole.
Definition: holegraphicsitem.h:48
Event
Definition: hole.h:50
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:111
HoleGraphicsItem & operator=(const HoleGraphicsItem &rhs)=delete
QScopedPointer< PrimitiveHoleGraphicsItem > mGraphicsItem
Definition: holegraphicsitem.h:75
void updateHole() noexcept
Definition: holegraphicsitem.cpp:99
void holeEdited(const Hole &hole, Hole::Event event) noexcept
Definition: holegraphicsitem.cpp:82
QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition: holegraphicsitem.cpp:70
Hole & getHole() noexcept
Definition: holegraphicsitem.h:59
QPainterPath shape() const noexcept override
Definition: holegraphicsitem.cpp:66