LibrePCB Developers Documentation
Loading...
Searching...
No Matches
sgi_busline.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_SGI_BUSLINE_H
21#define LIBREPCB_EDITOR_SGI_BUSLINE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31#include <memory>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class Bus;
39
40namespace editor {
41
42class GraphicsLayer;
43class GraphicsLayerList;
44
45/*******************************************************************************
46 * Class SGI_BusLine
47 ******************************************************************************/
48
52class SGI_BusLine final : public QGraphicsItem {
53public:
54 // Constructors / Destructor
55 SGI_BusLine() = delete;
56 SGI_BusLine(const SGI_BusLine& other) = delete;
57 SGI_BusLine(SI_BusLine& line, const GraphicsLayerList& layers) noexcept;
58 virtual ~SGI_BusLine() noexcept;
59
60 // General Methods
61 SI_BusLine& getBusLine() noexcept { return mBusLine; }
62
63 // Inherited from QGraphicsItem
64 QRectF boundingRect() const noexcept override { return mBoundingRect; }
65 QPainterPath shape() const noexcept override;
66 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
67 QWidget* widget) noexcept override;
68
69 // Operator Overloadings
70 SGI_BusLine& operator=(const SGI_BusLine& rhs) = delete;
71
72private: // Methods
73 void busLineEdited(const SI_BusLine& obj, SI_BusLine::Event event) noexcept;
74 void updatePositions() noexcept;
75 void updateBusName() noexcept;
76 std::shared_ptr<GraphicsLayer> getLayer(const QString& name) const noexcept;
77
78private: // Data
80 std::shared_ptr<const GraphicsLayer> mLayer;
81
82 // Cached Attributes
83 QLineF mLineF;
85 QPainterPath mShape;
86
87 // Slots
89};
90
91/*******************************************************************************
92 * End of File
93 ******************************************************************************/
94
95} // namespace editor
96} // namespace librepcb
97
98#endif
The SI_BusLine class.
Definition si_busline.h:47
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition graphicslayer.h:53
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
The SGI_BusLine class.
Definition sgi_busline.h:52
QRectF boundingRect() const noexcept override
Definition sgi_busline.h:64
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) noexcept override
Definition sgi_busline.cpp:75
QPainterPath mShape
Definition sgi_busline.h:85
SGI_BusLine(const SGI_BusLine &other)=delete
SI_BusLine & getBusLine() noexcept
Definition sgi_busline.h:61
std::shared_ptr< GraphicsLayer > getLayer(const QString &name) const noexcept
QPainterPath shape() const noexcept override
Definition sgi_busline.cpp:71
void updatePositions() noexcept
Definition sgi_busline.cpp:114
virtual ~SGI_BusLine() noexcept
Definition sgi_busline.cpp:64
std::shared_ptr< const GraphicsLayer > mLayer
Definition sgi_busline.h:80
QRectF mBoundingRect
Definition sgi_busline.h:84
void busLineEdited(const SI_BusLine &obj, SI_BusLine::Event event) noexcept
Definition sgi_busline.cpp:97
SI_BusLine::OnEditedSlot mOnBusLineEditedSlot
Definition sgi_busline.h:88
QLineF mLineF
Definition sgi_busline.h:83
SI_BusLine & mBusLine
Definition sgi_busline.h:79
void updateBusName() noexcept
Definition sgi_busline.cpp:130
Definition occmodel.cpp:77
Definition uuid.h:186