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 Ivan Komissarov.
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>
8
9#include "qddshandler.h"
10
11#ifndef QT_NO_IMAGEFORMATPLUGIN
12
13#ifndef QT_NO_DATASTREAM
14
16
18{
19 Q_OBJECT
20 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "dds.json")
21public:
23 QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
24};
25
26QImageIOPlugin::Capabilities QDDSPlugin::capabilities(QIODevice *device, const QByteArray &format) const
27{
28 if (format == QByteArrayLiteral("dds"))
29 return Capabilities(CanRead | CanWrite);
30 if (!format.isEmpty())
31 return 0;
32 if (!device || !device->isOpen())
33 return 0;
34
35 Capabilities cap;
36 if (device->isReadable() && QDDSHandler::canRead(device))
37 cap |= CanRead;
38 if (device->isWritable())
39 cap |= CanWrite;
40 return cap;
41}
42
43QImageIOHandler *QDDSPlugin::create(QIODevice *device, const QByteArray &format) const
44{
45 QImageIOHandler *handler = new QDDSHandler;
46 handler->setDevice(device);
47 handler->setFormat(format);
48 return handler;
49}
50
51QT_END_NAMESPACE
52
53#include "main.moc"
54
55#endif // QT_NO_DATASTREAM
56
57#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:43
Combined button and popup list for selecting options.