Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qcocoaprintdevice_p.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 QCOCOAPRINTDEVICE_H
5#define QCOCOAPRINTDEVICE_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#include <private/qglobal_p.h>
20
21#ifndef QT_NO_PRINTER
22
23#include <QtCore/qhash.h>
24#include <ApplicationServices/ApplicationServices.h>
25
26#include <QtPrintSupport/qtprintsupportglobal.h>
27
28#include <cups/ppd.h>
29
31
33{
34public:
36 explicit QCocoaPrintDevice(const QString &id);
37 virtual ~QCocoaPrintDevice();
38
39 bool isValid() const override;
40 bool isDefault() const override;
41
42 QPrint::DeviceState state() const override;
43
44 QPageSize defaultPageSize() const override;
45
47 int resolution) const override;
48
49 int defaultResolution() const override;
50
51 QPrint::InputSlot defaultInputSlot() const override;
52
53 QPrint::OutputBin defaultOutputBin() const override;
54
56
57 QPrint::ColorMode defaultColorMode() const override;
58
59 PMPrinter macPrinter() const;
60 PMPaper macPaper(const QPageSize &pageSize) const;
61
62protected:
63 void loadPageSizes() const override;
64 void loadResolutions() const override;
65 void loadInputSlots() const override;
66 void loadOutputBins() const override;
67 void loadDuplexModes() const override;
68 void loadColorModes() const override;
69#if QT_CONFIG(mimetype)
70 void loadMimeTypes() const override;
71#endif
72
73private:
74 QPageSize createPageSize(const PMPaper &paper) const;
75 bool openPpdFile();
76
77 // Mac Core Printing
78 PMPrinter m_printer;
79 PMPrintSession m_session;
80 mutable QHash<QString, PMPaper> m_macPapers;
81
82 // PPD File
83 ppd_file_t *m_ppd;
84
85 QMarginsF m_customMargins;
86 mutable QHash<QString, QMarginsF> m_printableMargins;
87};
88
90
91#endif // QT_NO_PRINTER
92#endif // QCOCOAPRINTDEVICE_H
int defaultResolution() const override
QPrint::OutputBin defaultOutputBin() const override
void loadResolutions() const override
QPageSize defaultPageSize() const override
void loadOutputBins() const override
void loadColorModes() const override
QPrint::DeviceState state() const override
PMPrinter macPrinter() const
QPrint::DuplexMode defaultDuplexMode() const override
QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation, int resolution) const override
void loadDuplexModes() const override
QPrint::InputSlot defaultInputSlot() const override
bool isDefault() const override
PMPaper macPaper(const QPageSize &pageSize) const
bool isValid() const override
QPrint::ColorMode defaultColorMode() const override
void loadPageSizes() const override
void loadInputSlots() const override
\inmodule QtCore
Definition qmargins.h:270
Orientation
This enum type defines the page orientation.
Definition qpagelayout.h:33
\inmodule QtGui
Definition qpagesize.h:22
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
ColorMode
Definition qprint_p.h:72
DuplexMode
Definition qprint_p.h:64
DeviceState
Definition qprint_p.h:56
Combined button and popup list for selecting options.