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#include <qimageiohandler.h>
6#include <qstringlist.h>
7
8#ifdef QT_NO_IMAGEFORMAT_GIF
9#undef QT_NO_IMAGEFORMAT_GIF
10#endif
11#include <qgifhandler_p.h>
12
14
16{
17 Q_OBJECT
18 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "gif.json")
19public:
22
23 Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
24 QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
25};
26
27QGifPlugin::QGifPlugin()
28{
29}
30
34
35QImageIOPlugin::Capabilities QGifPlugin::capabilities(QIODevice *device, const QByteArray &format) const
36{
37 if (format == "gif" || (device && device->isReadable() && QGifHandler::canRead(device)))
38 return Capabilities(CanRead);
39 return { };
40}
41
42QImageIOHandler *QGifPlugin::create(QIODevice *device, const QByteArray &format) const
43{
44 QImageIOHandler *handler = new QGifHandler;
45 handler->setDevice(device);
46 handler->setFormat(format);
47 return handler;
48}
49
50QT_END_NAMESPACE
51
52#include "main.moc"
QImageIOHandler * create(QIODevice *device, const QByteArray &format=QByteArray()) const override
Creates and returns a QImageIOHandler subclass, with device and format set.
Definition main.cpp:42
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override
Returns the capabilities of the plugin, based on the data in device and the format format.
Definition main.cpp:35
~QGifPlugin()
Definition main.cpp:31
Combined button and popup list for selecting options.