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>
This commit is contained in:
Albert Astals Cid 2017-12-04 12:53:04 +01:00 committed by Shawn Rutledge
parent fb1836898f
commit f135d515e8

View File

@ -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());