QPageSetupWidget::setPrinter: Use printdevice default paper size
This means that actually the paper size set on system settings (or lpoptions) is used instead of A4 Change-Id: I2dd86fd9ba210a335773430328b0ba2d3343395f Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
parent
414a703036
commit
ff67dedaaf
@ -210,7 +210,7 @@ void QUnixPageSetupDialogPrivate::init()
|
||||
Q_Q(QPageSetupDialog);
|
||||
|
||||
widget = new QPageSetupWidget(q);
|
||||
widget->setPrinter(printer, printer->outputFormat(), printer->printerName());
|
||||
widget->setPrinter(printer, nullptr, printer->outputFormat(), printer->printerName());
|
||||
|
||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok
|
||||
| QDialogButtonBox::Cancel,
|
||||
@ -371,12 +371,17 @@ void QPageSetupWidget::initPageSizes()
|
||||
|
||||
// Set the dialog to use the given QPrinter
|
||||
// Usually only called on first creation
|
||||
void QPageSetupWidget::setPrinter(QPrinter *printer, QPrinter::OutputFormat outputFormat, const QString &printerName)
|
||||
void QPageSetupWidget::setPrinter(QPrinter *printer, QPrintDevice *printDevice,
|
||||
QPrinter::OutputFormat outputFormat, const QString &printerName)
|
||||
{
|
||||
m_printer = printer;
|
||||
|
||||
// Initialize the layout to the current QPrinter layout
|
||||
m_pageLayout = m_printer->pageLayout();
|
||||
|
||||
if (printDevice)
|
||||
m_pageLayout.setPageSize(printDevice->defaultPageSize());
|
||||
|
||||
// Assume if margins are Points then is by default, so set to locale default units
|
||||
if (m_pageLayout.units() == QPageLayout::Point) {
|
||||
if (QLocale().measurementSystem() == QLocale::MetricSystem)
|
||||
|
@ -64,6 +64,7 @@ QT_REQUIRE_CONFIG(printdialog);
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QPrinter;
|
||||
class QPrintDevice;
|
||||
class QPagePreview;
|
||||
|
||||
class QPageSetupWidget : public QWidget {
|
||||
@ -71,7 +72,8 @@ class QPageSetupWidget : public QWidget {
|
||||
public:
|
||||
explicit QPageSetupWidget(QWidget *parent = 0);
|
||||
|
||||
void setPrinter(QPrinter *printer, QPrinter::OutputFormat outputFormat, const QString &printerName);
|
||||
void setPrinter(QPrinter *printer, QPrintDevice *printDevice,
|
||||
QPrinter::OutputFormat outputFormat, const QString &printerName);
|
||||
void setupPrinter() const;
|
||||
|
||||
private slots:
|
||||
|
@ -330,7 +330,7 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QPrintDevice *
|
||||
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, outputFormat, printerName);
|
||||
widget.pageSetup->setPrinter(printer, currentPrintDevice, outputFormat, printerName);
|
||||
|
||||
#if QT_CONFIG(cupsjobwidget)
|
||||
m_jobOptions = new QCupsJobWidget(printer, currentPrintDevice);
|
||||
|
Loading…
x
Reference in New Issue
Block a user