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) 2019 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
5
7
9{
10 Q_OBJECT
11 Q_PLUGIN_METADATA(IID QImageIOHandlerFactoryInterface_iid FILE "pdf.json")
12
13public:
15 QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
16};
17
18QImageIOPlugin::Capabilities QPdfPlugin::capabilities(QIODevice *device, const QByteArray &format) const
19{
20 if (format == "pdf")
21 return Capabilities(CanRead);
22 if (!format.isEmpty())
23 return {};
24
25 Capabilities cap;
26 if (device->isReadable() && QPdfIOHandler::canRead(device))
27 cap |= CanRead;
28 return cap;
29}
30
31QImageIOHandler *QPdfPlugin::create(QIODevice *device, const QByteArray &format) const
32{
33 QPdfIOHandler *hand = new QPdfIOHandler();
34 hand->setDevice(device);
35 hand->setFormat(format);
36 return hand;
37}
38
39QT_END_NAMESPACE
40
41#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:31