Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
<
qstringlist
.
h
>
7
8
#
include
<
qjpeghandler_p
.
h
>
9
10
QT_BEGIN_NAMESPACE
11
12
class
QJpegPlugin
:
public
QImageIOPlugin
13
{
14
Q_OBJECT
15
Q_PLUGIN_METADATA(IID
"org.qt-project.Qt.QImageIOHandlerFactoryInterface"
FILE
"jpeg.json"
)
16
public
:
17
Capabilities
capabilities
(
QIODevice
*
device
,
const
QByteArray
&
format
)
const
override
;
18
QImageIOHandler
*
create
(QIODevice *device,
const
QByteArray &format = QByteArray())
const
override
;
19
};
20
21
QImageIOPlugin::Capabilities
QJpegPlugin
::capabilities(QIODevice *device,
const
QByteArray &format)
const
22
{
23
if
(format ==
"jpeg"
|| format ==
"jpg"
|| format ==
"jfif"
)
24
return
Capabilities(CanRead | CanWrite);
25
if
(!format.isEmpty())
26
return
{ };
27
if
(!device->isOpen())
28
return
{ };
29
30
Capabilities cap;
31
if
(device->isReadable() && QJpegHandler::canRead(device))
32
cap |= CanRead;
33
if
(device->isWritable())
34
cap |= CanWrite;
35
return
cap;
36
}
37
38
QImageIOHandler
*
QJpegPlugin
::
create
(QIODevice *device,
const
QByteArray &format)
const
39
{
40
QImageIOHandler *handler =
new
QJpegHandler;
41
handler->setDevice(device);
42
handler->setFormat(format);
43
return
handler;
44
}
45
46
QT_END_NAMESPACE
47
48
#
include
"main.moc"
QJpegPlugin
Definition
main.cpp:13
QJpegPlugin::create
QImageIOHandler * create(QIODevice *device, const QByteArray &format=QByteArray()) const override
Creates and returns a QImageIOHandler subclass, with device and format set.
Definition
main.cpp:38
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtbase
src
plugins
imageformats
jpeg
main.cpp
Generated on
for Qt by
1.18.0