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
6#include <QtGui/QImageIOHandler>
7#include <QtCore/QDebug>
8
9#ifndef QT_NO_IMAGEFORMATPLUGIN
10
11#ifdef QT_NO_IMAGEFORMAT_TGA
12#undef QT_NO_IMAGEFORMAT_TGA
13#endif
14
15#include "qtgahandler.h"
16
18
20{
21 Q_OBJECT
22 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "tga.json")
23
24public:
26 QImageIOHandler * create(QIODevice * device, const QByteArray & format = QByteArray()) const override;
27};
28
29QImageIOPlugin::Capabilities QTgaPlugin::capabilities(QIODevice *device, const QByteArray &format) const
30{
31 if (format == "tga")
32 return Capabilities(CanRead);
33 Capabilities cap;
34 if (!format.isEmpty())
35 return cap;
36 if (!device->isOpen())
37 return cap;
38
39 if (device->isReadable() && QTgaHandler::canRead(device))
40 cap |= CanRead;
41 return cap;
42}
43
44QImageIOHandler* QTgaPlugin::create(QIODevice *device, const QByteArray &format) const
45{
46 QImageIOHandler *tgaHandler = new QTgaHandler();
47 tgaHandler->setDevice(device);
48 tgaHandler->setFormat(format);
49 return tgaHandler;
50}
51
52QT_END_NAMESPACE
53
54#include "main.moc"
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:44
Combined button and popup list for selecting options.