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
qppdprintdevice.h
Go to the documentation of this file.
1// Copyright (C) 2014 John Layt <jlayt@kde.org>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QPPDPRINTDEVICE_H
5#define QPPDPRINTDEVICE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of internal files. This header file may change from version to version
13// without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qpa/qplatformprintdevice.h>
19
20#include <QtCore/qbytearray.h>
21#include <QtCore/qhash.h>
22#include <QtCore/qmargins.h>
23
24#include <cups/cups.h>
25#include <cups/ppd.h>
26
27QT_BEGIN_NAMESPACE
28
29class QPpdPrintDevice : public QPlatformPrintDevice
30{
31public:
32 explicit QPpdPrintDevice(const QString &id);
33 virtual ~QPpdPrintDevice();
34
35 bool isValid() const override;
36 bool isDefault() const override;
37
38 QPrint::DeviceState state() const override;
39
40 QPageSize defaultPageSize() const override;
41
42 QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation,
43 int resolution) const override;
44
45 int defaultResolution() const override;
46
47 QPrint::InputSlot defaultInputSlot() const override;
48
49 QPrint::OutputBin defaultOutputBin() const override;
50
51 QPrint::DuplexMode defaultDuplexMode() const override;
52
53 QPrint::ColorMode defaultColorMode() const override;
54
55 QVariant property(QPrintDevice::PrintDevicePropertyKey key,
56 const QVariant &params = QVariant()) const override;
57 bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value) override;
58 bool isFeatureAvailable(QPrintDevice::PrintDevicePropertyKey key, const QVariant &params) const override;
59
60protected:
61 void loadPageSizes() const override;
62 void loadResolutions() const override;
63 void loadInputSlots() const override;
64 void loadOutputBins() const override;
65 void loadDuplexModes() const override;
66 void loadColorModes() const override;
67#if QT_CONFIG(mimetype)
68 void loadMimeTypes() const override;
69#endif
70
71private:
72 QString printerOption(const QString &key) const;
73 cups_ptype_e printerTypeFlags() const;
74
75 cups_dest_t *m_cupsDest;
76 ppd_file_t *m_ppd;
77 QByteArray m_cupsName;
78 QByteArray m_cupsInstance;
79 QMarginsF m_customMargins;
80 mutable QHash<QString, QMarginsF> m_printableMargins;
81};
82
84
85#endif // QPPDPRINTDEVICE_H
Combined button and popup list for selecting options.