#include <KoSvgPaste.h>
Definition at line 18 of file KoSvgPaste.h.
◆ KoSvgPaste()
| KoSvgPaste::KoSvgPaste |
( |
| ) |
|
◆ ~KoSvgPaste()
| KoSvgPaste::~KoSvgPaste |
( |
| ) |
|
|
virtual |
◆ fetchShapes()
| QList< KoShape * > KoSvgPaste::fetchShapes |
( |
QRectF | viewportInPx, |
|
|
qreal | resolutionPPI, |
|
|
QSizeF * | fragmentSize = nullptr ) |
Definition at line 56 of file KoSvgPaste.cpp.
57{
59
61
62 QByteArray data;
63
64 Q_FOREACH(
const QString &format,
d->
mimeData->formats()) {
65 if (format.toLower().contains("svg")) {
67 break;
68 }
69 }
70
71 if (data.isEmpty()) {
72 return shapes;
73 }
74
76
77}
const QMimeData * mimeData
static QList< KoShape * > fetchShapesFromData(const QByteArray &data, QRectF viewportInPx, qreal resolutionPPI, QSizeF *fragmentSize=nullptr)
References d, fetchShapesFromData(), and KoSvgPaste::Private::mimeData.
◆ fetchShapesFromData()
| QList< KoShape * > KoSvgPaste::fetchShapesFromData |
( |
const QByteArray & | data, |
|
|
QRectF | viewportInPx, |
|
|
qreal | resolutionPPI, |
|
|
QSizeF * | fragmentSize = nullptr ) |
|
static |
Definition at line 79 of file KoSvgPaste.cpp.
80{
82
83 if (data.isEmpty()) {
84 return shapes;
85 }
86
87
88
89 QString errorMsg;
90 int errorLine = 0;
91 int errorColumn = 0;
92
94 if (doc.isNull()) {
95 qWarning() << "Failed to process an SVG file at"
96 << errorLine << ":" << errorColumn << "->" << errorMsg;
97 return shapes;
98 }
99
102 parser.setResolution(viewportInPx, resolutionPPI);
103
104 shapes = parser.parseSvg(doc.documentElement(), fragmentSize);
105
106 return shapes;
107}
static QDomDocument createDocumentFromSvg(QIODevice *device, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0)
References SvgParser::createDocumentFromSvg(), SvgParser::parseSvg(), and SvgParser::setResolution().
◆ hasShapes()
| bool KoSvgPaste::hasShapes |
( |
| ) |
|
Definition at line 41 of file KoSvgPaste.cpp.
42{
43 bool hasSvg = false;
45 Q_FOREACH(
const QString &format,
d->
mimeData->formats()) {
46 if (format.toLower().contains("svg")) {
47 hasSvg = true;
48 break;
49 }
50 }
51 }
52
53 return hasSvg;
54}
References d, and KoSvgPaste::Private::mimeData.
◆ Q_DISABLE_COPY()
The documentation for this class was generated from the following files: