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