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