Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#include <qimageiohandler.h>
7#include <qstringlist.h>
8
9#if !defined(QT_NO_SVGRENDERER)
10
11#include "qsvgiohandler.h"
12
13#include <qiodevice.h>
14#include <qbytearray.h>
15#include <qdebug.h>
16
18
20{
21 Q_OBJECT
22#ifndef QT_NO_COMPRESS
23 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "svg.json")
24#else
25 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "svg-nocompress.json")
26#endif
27
28public:
30 QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
31};
32
33QImageIOPlugin::Capabilities QSvgPlugin::capabilities(QIODevice *device, const QByteArray &format) const
34{
35#ifndef QT_NO_COMPRESS
36 if (format == "svg" || format == "svgz")
37#else
38 if (format == "svg")
39#endif
40 return Capabilities(CanRead);
41 Capabilities cap;
42 if (!format.isEmpty())
43 return cap;
44 if (device->isReadable() && QSvgIOHandler::canRead(device))
45 cap |= CanRead;
46 return cap;
47}
48
49QImageIOHandler *QSvgPlugin::create(QIODevice *device, const QByteArray &format) const
50{
52 hand->setDevice(device);
53 hand->setFormat(format);
54 return hand;
55}
56
57QT_END_NAMESPACE
58
59#include "main.moc"
60
61#endif // !QT_NO_IMAGEFORMATPLUGIN
QImageIOHandler * create(QIODevice *device, const QByteArray &format=QByteArray()) const override
Creates and returns a QImageIOHandler subclass, with device and format set.
Definition main.cpp:49
Combined button and popup list for selecting options.