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#ifndef QT_NO_IMAGEFORMATPLUGIN
5
7
9
11{
12 Q_OBJECT
13 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "macjp2.json")
14
15public:
17 QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
18};
19
20QImageIOPlugin::Capabilities QMacJp2Plugin::capabilities(QIODevice *device, const QByteArray &format) const
21{
22 if (format == "jp2")
23 return Capabilities(CanRead | CanWrite);
24 Capabilities cap;
25 if (!format.isEmpty())
26 return cap;
27 if (!device->isOpen())
28 return cap;
29
30 if (device->isReadable() && QMacJp2Handler::canRead(device))
31 cap |= CanRead;
32 if (device->isWritable())
33 cap |= CanWrite;
34 return cap;
35}
36
37QImageIOHandler *QMacJp2Plugin::create(QIODevice *device, const QByteArray &format) const
38{
39 QMacJp2Handler *handler = new QMacJp2Handler();
40 handler->setDevice(device);
41 handler->setFormat(format);
42 return handler;
43}
44
45QT_END_NAMESPACE
46
47#include "main.moc"
48
49#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:37