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#include <qimageiohandler.h>
6#include <qdebug.h>
7
8#ifdef QT_NO_IMAGEFORMAT_ICO
9#undef QT_NO_IMAGEFORMAT_ICO
10#endif
11#include "qicohandler.h"
12
14
16{
17 Q_OBJECT
18 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ico.json")
19public:
21 QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
22};
23
24QImageIOPlugin::Capabilities QICOPlugin::capabilities(QIODevice *device, const QByteArray &format) const
25{
26 if (format == "ico" || format == "cur")
27 return Capabilities(CanRead | CanWrite);
28 if (!format.isEmpty())
29 return { };
30 if (!device->isOpen())
31 return { };
32
33 Capabilities cap;
34 if (device->isReadable() && QtIcoHandler::canRead(device))
35 cap |= CanRead;
36 if (device->isWritable())
37 cap |= CanWrite;
38 return cap;
39}
40
41QImageIOHandler *QICOPlugin::create(QIODevice *device, const QByteArray &format) const
42{
43 QImageIOHandler *handler = new QtIcoHandler(device);
44
45 handler->setFormat(format);
46 return handler;
47}
48
49QT_END_NAMESPACE
50
51#include "main.moc"
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
Combined button and popup list for selecting options.