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#ifndef QPAGESETUPDIALOG_UNIX_P_H
4#define QPAGESETUPDIALOG_UNIX_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// to version without notice, or even be removed.
13//
14// We mean it.
15//
16//
17
18#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
19
20#include "qprinter.h"
21#include "kernel/qprint_p.h"
22
23#include <QtGui/qpagelayout.h>
24
25#include <ui_qpagesetupwidget.h>
26
27QT_REQUIRE_CONFIG(printdialog);
28
29QT_BEGIN_NAMESPACE
30
31class QPrinter;
32class QPrintDevice;
33class QPagePreview;
34
35class QPageSetupWidget : public QWidget {
36 Q_OBJECT
37public:
38 explicit QPageSetupWidget(QWidget *parent = nullptr);
39
40 void setPrinter(QPrinter *printer, QPrintDevice *printDevice,
41 QPrinter::OutputFormat outputFormat, const QString &printerName);
42 void setupPrinter() const;
43 void updateSavedValues();
44 void revertToSavedValues();
45
46#if QT_CONFIG(cups)
47 bool hasPpdConflict() const;
48
49signals:
50 void ppdOptionChanged();
51#endif
52
53private slots:
54 void pageSizeChanged();
55 void pageOrientationChanged();
56 void pagesPerSheetChanged();
57 void unitChanged();
58 void topMarginChanged(double newValue);
59 void bottomMarginChanged(double newValue);
60 void leftMarginChanged(double newValue);
61 void rightMarginChanged(double newValue);
62
63private:
64 friend class QUnixPrintWidgetPrivate; // Needed by checkFields()
65
66 void updateWidget();
67 void initUnits();
68 void initPagesPerSheet();
69 void initPageSizes();
70
71 Ui::QPageSetupWidget m_ui;
72 QPagePreview *m_pagePreview;
73 QPrinter *m_printer;
74 QPrintDevice *m_printDevice;
75#if QT_CONFIG(cups)
76 ppd_option_t *m_pageSizePpdOption;
77#endif
78 QPrinter::OutputFormat m_outputFormat;
79 QString m_printerName;
80 QPageLayout m_pageLayout;
81 QPageLayout m_savedPageLayout;
82 QPageLayout::Unit m_units;
83 QPageLayout::Unit m_savedUnits;
84 int m_savedPagesPerSheet;
85 int m_savedPagesPerSheetLayout;
86 bool m_blockSignals;
87 int m_realCustomPageSizeIndex;
88};
89
90QT_END_NAMESPACE
91
92#endif
93

source code of qtbase/src/printsupport/dialogs/qpagesetupdialog_unix_p.h