forked from pool/libqt5-qtbase
86 lines
3.0 KiB
Diff
86 lines
3.0 KiB
Diff
|
From f135d515e8d6aaf1c136aef68e08b4f759075310 Mon Sep 17 00:00:00 2001
|
||
|
From: Albert Astals Cid <albert.astals.cid@kdab.com>
|
||
|
Date: Mon, 4 Dec 2017 12:53:04 +0100
|
||
|
Subject: [PATCH 04/54] Remove QPrintPropertiesDialog::applyPrinterProperties
|
||
|
|
||
|
It's only ever called after the constructor so merge its code to the constructor
|
||
|
|
||
|
Change-Id: Icca88764f725b9aeaa08ee7387da8885be247fba
|
||
|
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
|
||
|
---
|
||
|
src/printsupport/dialogs/qprintdialog_unix.cpp | 21 ++++++---------------
|
||
|
1 file changed, 6 insertions(+), 15 deletions(-)
|
||
|
|
||
|
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
|
||
|
index 66d37dbec3..6cccdd03cd 100644
|
||
|
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
|
||
|
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
|
||
|
@@ -124,13 +124,11 @@ class QPrintPropertiesDialog : public QDialog
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
- QPrintPropertiesDialog(QAbstractPrintDialog *parent = nullptr);
|
||
|
+ QPrintPropertiesDialog(QPrinter *printer, QAbstractPrintDialog *parent = nullptr);
|
||
|
~QPrintPropertiesDialog();
|
||
|
|
||
|
void selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName);
|
||
|
|
||
|
- /// copy printer properties to the widget
|
||
|
- void applyPrinterProperties(QPrinter *p);
|
||
|
void setupPrinter() const;
|
||
|
|
||
|
private:
|
||
|
@@ -236,7 +234,7 @@ public:
|
||
|
|
||
|
*/
|
||
|
|
||
|
-QPrintPropertiesDialog::QPrintPropertiesDialog(QAbstractPrintDialog *parent)
|
||
|
+QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QAbstractPrintDialog *parent)
|
||
|
: QDialog(parent)
|
||
|
{
|
||
|
setWindowTitle(tr("Printer Properties"));
|
||
|
@@ -250,8 +248,11 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QAbstractPrintDialog *parent)
|
||
|
connect(m_buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept()));
|
||
|
connect(m_buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
|
||
|
|
||
|
+ widget.pageSetup->setPrinter(printer);
|
||
|
+
|
||
|
#if QT_CONFIG(cupsjobwidget)
|
||
|
m_jobOptions = new QCupsJobWidget();
|
||
|
+ m_jobOptions->setPrinter(printer);
|
||
|
widget.tabs->addTab(m_jobOptions, tr("Job Options"));
|
||
|
#endif
|
||
|
}
|
||
|
@@ -260,14 +261,6 @@ QPrintPropertiesDialog::~QPrintPropertiesDialog()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
-void QPrintPropertiesDialog::applyPrinterProperties(QPrinter *p)
|
||
|
-{
|
||
|
- widget.pageSetup->setPrinter(p);
|
||
|
-#if QT_CONFIG(cupsjobwidget)
|
||
|
- m_jobOptions->setPrinter(p);
|
||
|
-#endif
|
||
|
-}
|
||
|
-
|
||
|
void QPrintPropertiesDialog::setupPrinter() const
|
||
|
{
|
||
|
widget.pageSetup->setupPrinter();
|
||
|
@@ -846,12 +839,10 @@ void QUnixPrintWidgetPrivate::setupPrinterProperties()
|
||
|
if (propertiesDialog)
|
||
|
delete propertiesDialog;
|
||
|
|
||
|
- propertiesDialog = new QPrintPropertiesDialog(q);
|
||
|
+ propertiesDialog = new QPrintPropertiesDialog(q->printer(), q);
|
||
|
propertiesDialog->setResult(QDialog::Rejected);
|
||
|
propertiesDialogShown = false;
|
||
|
|
||
|
- propertiesDialog->applyPrinterProperties(q->printer());
|
||
|
-
|
||
|
if (q->isOptionEnabled(QPrintDialog::PrintToFile)
|
||
|
&& (widget.printers->currentIndex() == widget.printers->count() - 1)) {// PDF
|
||
|
propertiesDialog->selectPrinter(QPrinter::PdfFormat, QString());
|
||
|
--
|
||
|
2.15.1
|
||
|
|