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:
parent
fb1836898f
commit
f135d515e8
@ -124,13 +124,11 @@ class QPrintPropertiesDialog : public QDialog
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QPrintPropertiesDialog(QAbstractPrintDialog *parent = nullptr);
|
QPrintPropertiesDialog(QPrinter *printer, QAbstractPrintDialog *parent = nullptr);
|
||||||
~QPrintPropertiesDialog();
|
~QPrintPropertiesDialog();
|
||||||
|
|
||||||
void selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName);
|
void selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName);
|
||||||
|
|
||||||
/// copy printer properties to the widget
|
|
||||||
void applyPrinterProperties(QPrinter *p);
|
|
||||||
void setupPrinter() const;
|
void setupPrinter() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -236,7 +234,7 @@ public:
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QPrintPropertiesDialog::QPrintPropertiesDialog(QAbstractPrintDialog *parent)
|
QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QAbstractPrintDialog *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Printer Properties"));
|
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::Ok), SIGNAL(clicked()), this, SLOT(accept()));
|
||||||
connect(m_buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
|
connect(m_buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
|
||||||
|
|
||||||
|
widget.pageSetup->setPrinter(printer);
|
||||||
|
|
||||||
#if QT_CONFIG(cupsjobwidget)
|
#if QT_CONFIG(cupsjobwidget)
|
||||||
m_jobOptions = new QCupsJobWidget();
|
m_jobOptions = new QCupsJobWidget();
|
||||||
|
m_jobOptions->setPrinter(printer);
|
||||||
widget.tabs->addTab(m_jobOptions, tr("Job Options"));
|
widget.tabs->addTab(m_jobOptions, tr("Job Options"));
|
||||||
#endif
|
#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
|
void QPrintPropertiesDialog::setupPrinter() const
|
||||||
{
|
{
|
||||||
widget.pageSetup->setupPrinter();
|
widget.pageSetup->setupPrinter();
|
||||||
@ -846,12 +839,10 @@ void QUnixPrintWidgetPrivate::setupPrinterProperties()
|
|||||||
if (propertiesDialog)
|
if (propertiesDialog)
|
||||||
delete propertiesDialog;
|
delete propertiesDialog;
|
||||||
|
|
||||||
propertiesDialog = new QPrintPropertiesDialog(q);
|
propertiesDialog = new QPrintPropertiesDialog(q->printer(), q);
|
||||||
propertiesDialog->setResult(QDialog::Rejected);
|
propertiesDialog->setResult(QDialog::Rejected);
|
||||||
propertiesDialogShown = false;
|
propertiesDialogShown = false;
|
||||||
|
|
||||||
propertiesDialog->applyPrinterProperties(q->printer());
|
|
||||||
|
|
||||||
if (q->isOptionEnabled(QPrintDialog::PrintToFile)
|
if (q->isOptionEnabled(QPrintDialog::PrintToFile)
|
||||||
&& (widget.printers->currentIndex() == widget.printers->count() - 1)) {// PDF
|
&& (widget.printers->currentIndex() == widget.printers->count() - 1)) {// PDF
|
||||||
propertiesDialog->selectPrinter(QPrinter::PdfFormat, QString());
|
propertiesDialog->selectPrinter(QPrinter::PdfFormat, QString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user