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// Copyright (C) 2016 Alex Char.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6
7#include <QtGui/qimageiohandler.h>
9
10#ifndef QT_NO_IMAGEFORMATPLUGIN
11#ifndef QT_NO_DATASTREAM
12
14
16{
17 Q_OBJECT
18 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "icns.json")
19
20public:
22 QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
23};
24
25QImageIOPlugin::Capabilities QICNSPlugin::capabilities(QIODevice *device, const QByteArray &format) const
26{
27 if (format == QByteArrayLiteral("icns"))
28 return Capabilities(CanRead | CanWrite);
29 Capabilities cap;
30 if (!format.isEmpty())
31 return cap;
32 if (!device || !device->isOpen())
33 return cap;
34
35 if (device->isReadable() && QICNSHandler::canRead(device))
36 cap |= CanRead;
37 if (device->isWritable())
38 cap |= CanWrite;
39 return cap;
40}
41
42QImageIOHandler *QICNSPlugin::create(QIODevice *device, const QByteArray &format) const
43{
44 QImageIOHandler *handler = new QICNSHandler();
45 handler->setDevice(device);
46 handler->setFormat(format);
47 return handler;
48}
49
50QT_END_NAMESPACE
51
52#include "main.moc"
53
54#endif // QT_NO_DATASTREAM
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:42
Combined button and popup list for selecting options.