Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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#include <qiiofhelpers_p.h>
8
10
12{
14 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "macheif.json")
15
16public:
17 Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
19};
20
21QImageIOPlugin::Capabilities QMacHeifPlugin::capabilities(QIODevice *device, const QByteArray &format) const
22{
23 static const Capabilities sysCaps = QIIOFHelpers::systemCapabilities(QStringLiteral("public.heic"));
24
25 Capabilities cap;
26 if (!sysCaps)
27 return cap;
28 if (format == "heic" || format == "heif")
29 return sysCaps;
30 if (!format.isEmpty())
31 return cap;
32 if (!device->isOpen())
33 return cap;
34
35 if (sysCaps.testFlag(CanRead) && device->isReadable() && QMacHeifHandler::canRead(device))
36 cap |= CanRead;
37 if (sysCaps.testFlag(CanWrite) && device->isWritable())
38 cap |= CanWrite;
39 return cap;
40}
41
43{
44 QMacHeifHandler *handler = new QMacHeifHandler();
45 handler->setDevice(device);
46 handler->setFormat(format);
47 return handler;
48}
49
51
52#include "main.moc"
53
54#endif // !QT_NO_IMAGEFORMATPLUGIN
IOBluetoothDevice * device
\inmodule QtCore
Definition qbytearray.h:57
static QImageIOPlugin::Capabilities systemCapabilities(const QString &uti)
\inmodule QtCore \reentrant
Definition qiodevice.h:34
The QImageIOHandler class defines the common image I/O interface for all image formats in Qt.
void setDevice(QIODevice *device)
Sets the device of the QImageIOHandler to device.
void setFormat(const QByteArray &format)
Sets the format of the QImageIOHandler to format.
\inmodule QtGui
bool canRead() const override
Returns true if an image can be read from the device (i.e., the image format is supported,...
QImageIOHandler * create(QIODevice *device, const QByteArray &format=QByteArray()) const override
Creates and returns a QImageIOHandler subclass, with device and format set.
Definition main.cpp:42
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override
Returns the capabilities of the plugin, based on the data in device and the format format.
Definition main.cpp:21
Combined button and popup list for selecting options.
GLint GLsizei GLsizei GLenum format
GLenum cap
#define QStringLiteral(str)
#define Q_OBJECT
#define Q_PLUGIN_METADATA(x)
view create()