Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#include <qimageiohandler.h>
5#include <qdebug.h>
6
7#ifdef QT_NO_IMAGEFORMAT_ICO
8#undef QT_NO_IMAGEFORMAT_ICO
9#endif
10#include "qicohandler.h"
11
13
15{
17 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ico.json")
18public:
19 Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
21};
22
23QImageIOPlugin::Capabilities QICOPlugin::capabilities(QIODevice *device, const QByteArray &format) const
24{
25 if (format == "ico" || format == "cur")
26 return Capabilities(CanRead | CanWrite);
27 if (!format.isEmpty())
28 return { };
29 if (!device->isOpen())
30 return { };
31
32 Capabilities cap;
33 if (device->isReadable() && QtIcoHandler::canRead(device))
34 cap |= CanRead;
35 if (device->isWritable())
36 cap |= CanWrite;
37 return cap;
38}
39
41{
42 QImageIOHandler *handler = new QtIcoHandler(device);
43
44 handler->setFormat(format);
45 return handler;
46}
47
49
50#include "main.moc"
IOBluetoothDevice * device
\inmodule QtCore
Definition qbytearray.h:57
QImageIOHandler * create(QIODevice *device, const QByteArray &format=QByteArray()) const override
Creates and returns a QImageIOHandler subclass, with device and format set.
Definition main.cpp:40
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:23
\inmodule QtCore \reentrant
Definition qiodevice.h:34
The QImageIOHandler class defines the common image I/O interface for all image formats in Qt.
void setFormat(const QByteArray &format)
Sets the format of the QImageIOHandler to format.
\inmodule QtGui
The QtIcoHandler class provides support for the ICO image format.
Definition qicohandler.h:12
bool canRead() const override
Verifies if some values (magic bytes) are set as expected in the header of the file.
Combined button and popup list for selecting options.
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
GLint GLsizei GLsizei GLenum format
GLenum cap
#define Q_OBJECT
#define Q_PLUGIN_METADATA(x)
view create()