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) 2017 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
6#include <qmacheifhandler.h>
7
9
11{
12 Q_OBJECT
13 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "macheif.json")
14
15public:
17 QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
18};
19
20QImageIOPlugin::Capabilities QMacHeifPlugin::capabilities(QIODevice *device, const QByteArray &format) const
21{
22 static const Capabilities sysCaps = QIIOFHelpers::systemCapabilities(QStringLiteral("public.heic"));
23
24 Capabilities cap;
25 if (!sysCaps)
26 return cap;
27 if (format == "heic" || format == "heif")
28 return sysCaps;
29 if (!format.isEmpty())
30 return cap;
31 if (!device->isOpen())
32 return cap;
33
34 if (sysCaps.testFlag(CanRead) && device->isReadable() && QMacHeifHandler::canRead(device))
35 cap |= CanRead;
36 if (sysCaps.testFlag(CanWrite) && device->isWritable())
37 cap |= CanWrite;
38 return cap;
39}
40
41QImageIOHandler *QMacHeifPlugin::create(QIODevice *device, const QByteArray &format) const
42{
44 handler->setDevice(device);
45 handler->setFormat(format);
46 return handler;
47}
48
49QT_END_NAMESPACE
50
51#include "main.moc"
52
53#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:41