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#ifndef QT_NO_IMAGEFORMATPLUGIN
10
11#ifdef QT_NO_IMAGEFORMAT_MNG
12#undef QT_NO_IMAGEFORMAT_MNG
13#endif
14#include "qmnghandler_p.h"
15
16#include <qiodevice.h>
17#include <qbytearray.h>
18
20
22{
23 Q_OBJECT
24 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "mng.json")
25
26public:
28 QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
29};
30
31QImageIOPlugin::Capabilities QMngPlugin::capabilities(QIODevice *device, const QByteArray &format) const
32{
33 if (format == "mng")
34 return Capabilities(CanRead);
35 Capabilities cap;
36 if (!format.isEmpty())
37 return cap;
38 if (!device->isOpen())
39 return cap;
40
41 if (device->isReadable() && QMngHandler::canRead(device))
42 cap |= CanRead;
43 return cap;
44}
45
46QImageIOHandler *QMngPlugin::create(QIODevice *device, const QByteArray &format) const
47{
48 QMngHandler *hand = new QMngHandler();
49 hand->setDevice(device);
50 hand->setFormat(format);
51 return hand;
52}
53
54QT_END_NAMESPACE
55
56#include "main.moc"
57
58#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:46
Combined button and popup list for selecting options.