LibrePCB Developers Documentation
Loading...
Searching...
No Matches
graphicsscene.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_GRAPHICSSCENE_H
21#define LIBREPCB_EDITOR_GRAPHICSSCENE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27#include <QtWidgets>
28
29/*******************************************************************************
30 * Namespace / Forward Declarations
31 ******************************************************************************/
32namespace librepcb {
33
34class Point;
35
36namespace editor {
37
38/*******************************************************************************
39 * Class GraphicsScene
40 ******************************************************************************/
41
45class GraphicsScene : public QGraphicsScene {
46 Q_OBJECT
47
48public:
49 // Constructors / Destructor
50 explicit GraphicsScene(QObject* parent = nullptr) noexcept;
51 virtual ~GraphicsScene() noexcept;
52
53 // General Methods
54 void addItem(QGraphicsItem& item) noexcept;
55 void removeItem(QGraphicsItem& item) noexcept;
56 void setSelectionRectColors(const QColor& line, const QColor& fill) noexcept;
57 void setSelectionRect(const Point& p1, const Point& p2) noexcept;
58 void clearSelectionRect() noexcept;
59 QPixmap toPixmap(int dpi,
60 const QColor& background = Qt::transparent) noexcept;
61 QPixmap toPixmap(const QSize& size,
62 const QColor& background = Qt::transparent) noexcept;
63
64private:
65 QGraphicsRectItem* mSelectionRectItem;
66};
67
68/*******************************************************************************
69 * End of File
70 ******************************************************************************/
71
72} // namespace editor
73} // namespace librepcb
74
75#endif
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The GraphicsScene class.
Definition graphicsscene.h:45
void clearSelectionRect() noexcept
Definition graphicsscene.cpp:81
void addItem(QGraphicsItem &item) noexcept
Definition graphicsscene.cpp:59
void setSelectionRectColors(const QColor &line, const QColor &fill) noexcept
Definition graphicsscene.cpp:69
QPixmap toPixmap(int dpi, const QColor &background=Qt::transparent) noexcept
Definition graphicsscene.cpp:85
virtual ~GraphicsScene() noexcept
Definition graphicsscene.cpp:49
void removeItem(QGraphicsItem &item) noexcept
Definition graphicsscene.cpp:64
void setSelectionRect(const Point &p1, const Point &p2) noexcept
Definition graphicsscene.cpp:75
QGraphicsRectItem * mSelectionRectItem
Definition graphicsscene.h:65
Definition occmodel.cpp:76