From 881690969cc5a6a78df41e2d80ea1fa7bf07cb27 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 4 Dec 2017 12:57:40 +0100 Subject: [PATCH 05/54] Remove QCupsJobWidget::setPrinter It is only ever called after the constructor so merge the code Change-Id: I381165ad90c85342e5db3c16327d729388b71fb2 Reviewed-by: Andy Shaw --- src/printsupport/dialogs/qprintdialog_unix.cpp | 3 +-- src/printsupport/widgets/qcupsjobwidget.cpp | 10 +++------- src/printsupport/widgets/qcupsjobwidget_p.h | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 6cccdd03cd..8c9997d572 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -251,8 +251,7 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QAbstractPrint widget.pageSetup->setPrinter(printer); #if QT_CONFIG(cupsjobwidget) - m_jobOptions = new QCupsJobWidget(); - m_jobOptions->setPrinter(printer); + m_jobOptions = new QCupsJobWidget(printer); widget.tabs->addTab(m_jobOptions, tr("Job Options")); #endif } diff --git a/src/printsupport/widgets/qcupsjobwidget.cpp b/src/printsupport/widgets/qcupsjobwidget.cpp index 00f2d64df2..8fb07c86b0 100644 --- a/src/printsupport/widgets/qcupsjobwidget.cpp +++ b/src/printsupport/widgets/qcupsjobwidget.cpp @@ -64,8 +64,9 @@ QT_BEGIN_NAMESPACE \inmodule QtPrintSupport */ -QCupsJobWidget::QCupsJobWidget(QWidget *parent) - : QWidget(parent) +QCupsJobWidget::QCupsJobWidget(QPrinter *printer, QWidget *parent) + : QWidget(parent), + m_printer(printer) { m_ui.setupUi(this); //set all the default values @@ -80,11 +81,6 @@ QCupsJobWidget::~QCupsJobWidget() { } -void QCupsJobWidget::setPrinter(QPrinter *printer) -{ - m_printer = printer; -} - void QCupsJobWidget::setupPrinter() { QCUPSSupport::setJobHold(m_printer, jobHold(), jobHoldTime()); diff --git a/src/printsupport/widgets/qcupsjobwidget_p.h b/src/printsupport/widgets/qcupsjobwidget_p.h index 7d3c15938f..2aca6bc928 100644 --- a/src/printsupport/widgets/qcupsjobwidget_p.h +++ b/src/printsupport/widgets/qcupsjobwidget_p.h @@ -71,9 +71,8 @@ class QCupsJobWidget : public QWidget Q_OBJECT public: - explicit QCupsJobWidget(QWidget *parent = 0); + explicit QCupsJobWidget(QPrinter *printer, QWidget *parent = nullptr); ~QCupsJobWidget(); - void setPrinter(QPrinter *printer); void setupPrinter(); private Q_SLOTS: -- 2.15.1