LibrePCB Developers Documentation
symbolclipboarddata.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_SYMBOLCLIPBOARDDATA_H
21#define LIBREPCB_EDITOR_SYMBOLCLIPBOARDDATA_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26
31
32#include <QtCore>
33#include <QtWidgets>
34
35#include <memory>
36
37/*******************************************************************************
38 * Namespace / Forward Declarations
39 ******************************************************************************/
40namespace librepcb {
41namespace editor {
42
43class IF_GraphicsLayerProvider;
44
45/*******************************************************************************
46 * Class SymbolClipboardData
47 ******************************************************************************/
48
53public:
54 // Constructors / Destructor
57 SymbolClipboardData(const Uuid& symbolUuid, const Point& cursorPos) noexcept;
58 explicit SymbolClipboardData(const SExpression& node);
59 ~SymbolClipboardData() noexcept;
60
61 // Getters
62 bool getItemCount() const noexcept {
63 return mPins.count() + mPolygons.count() + mCircles.count() +
64 mTexts.count();
65 }
66 const Uuid& getSymbolUuid() const noexcept { return mSymbolUuid; }
67 const Point& getCursorPos() const noexcept { return mCursorPos; }
68 SymbolPinList& getPins() noexcept { return mPins; }
69 const SymbolPinList& getPins() const noexcept { return mPins; }
70 PolygonList& getPolygons() noexcept { return mPolygons; }
71 const PolygonList& getPolygons() const noexcept { return mPolygons; }
72 CircleList& getCircles() noexcept { return mCircles; }
73 const CircleList& getCircles() const noexcept { return mCircles; }
74 TextList& getTexts() noexcept { return mTexts; }
75 const TextList& getTexts() const noexcept { return mTexts; }
76
77 // General Methods
78 std::unique_ptr<QMimeData> toMimeData(const IF_GraphicsLayerProvider& lp);
79 static std::unique_ptr<SymbolClipboardData> fromMimeData(
80 const QMimeData* mime);
81
82 // Operator Overloadings
84
85private: // Methods
86 QPixmap generatePixmap(const IF_GraphicsLayerProvider& lp) noexcept;
87 static QString getMimeType() noexcept;
88
89private: // Data
96};
97
98/*******************************************************************************
99 * End of File
100 ******************************************************************************/
101
102} // namespace editor
103} // namespace librepcb
104
105#endif
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The SExpression class.
Definition: sexpression.h:69
int count() const noexcept
Definition: serializableobjectlist.h:199
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition: graphicslayer.h:111
The SymbolClipboardData class.
Definition: symbolclipboarddata.h:52
static QString getMimeType() noexcept
Definition: symbolclipboarddata.cpp:135
SymbolClipboardData(const SymbolClipboardData &other)=delete
const SymbolPinList & getPins() const noexcept
Definition: symbolclipboarddata.h:69
SymbolPinList mPins
Definition: symbolclipboarddata.h:92
TextList mTexts
Definition: symbolclipboarddata.h:95
static std::unique_ptr< SymbolClipboardData > fromMimeData(const QMimeData *mime)
Definition: symbolclipboarddata.cpp:96
PolygonList & getPolygons() noexcept
Definition: symbolclipboarddata.h:70
CircleList mCircles
Definition: symbolclipboarddata.h:94
TextList & getTexts() noexcept
Definition: symbolclipboarddata.h:74
const PolygonList & getPolygons() const noexcept
Definition: symbolclipboarddata.h:71
bool getItemCount() const noexcept
Definition: symbolclipboarddata.h:62
Uuid mSymbolUuid
Definition: symbolclipboarddata.h:90
const Point & getCursorPos() const noexcept
Definition: symbolclipboarddata.h:67
const CircleList & getCircles() const noexcept
Definition: symbolclipboarddata.h:73
SymbolClipboardData & operator=(const SymbolClipboardData &rhs)=delete
const TextList & getTexts() const noexcept
Definition: symbolclipboarddata.h:75
SymbolPinList & getPins() noexcept
Definition: symbolclipboarddata.h:68
PolygonList mPolygons
Definition: symbolclipboarddata.h:93
CircleList & getCircles() noexcept
Definition: symbolclipboarddata.h:72
const Uuid & getSymbolUuid() const noexcept
Definition: symbolclipboarddata.h:66
std::unique_ptr< QMimeData > toMimeData(const IF_GraphicsLayerProvider &lp)
Definition: symbolclipboarddata.cpp:67
~SymbolClipboardData() noexcept
Definition: symbolclipboarddata.cpp:60
Point mCursorPos
Definition: symbolclipboarddata.h:91
QPixmap generatePixmap(const IF_GraphicsLayerProvider &lp) noexcept
Definition: symbolclipboarddata.cpp:113
Definition: occmodel.cpp:77