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);
|
Q_Q(QPageSetupDialog);
|
||||||
|
|
||||||
widget = new QPageSetupWidget(q);
|
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 *buttons = new QDialogButtonBox(QDialogButtonBox::Ok
|
||||||
| QDialogButtonBox::Cancel,
|
| QDialogButtonBox::Cancel,
|
||||||
@ -371,12 +371,17 @@ void QPageSetupWidget::initPageSizes()
|
|||||||
|
|
||||||
// Set the dialog to use the given QPrinter
|
// Set the dialog to use the given QPrinter
|
||||||
// Usually only called on first creation
|
// 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;
|
m_printer = printer;
|
||||||
|
|
||||||
// Initialize the layout to the current QPrinter layout
|
// Initialize the layout to the current QPrinter layout
|
||||||
m_pageLayout = m_printer->pageLayout();
|
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
|
// Assume if margins are Points then is by default, so set to locale default units
|
||||||
if (m_pageLayout.units() == QPageLayout::Point) {
|
if (m_pageLayout.units() == QPageLayout::Point) {
|
||||||
if (QLocale().measurementSystem() == QLocale::MetricSystem)
|
if (QLocale().measurementSystem() == QLocale::MetricSystem)
|
||||||
|
@ -64,6 +64,7 @@ QT_REQUIRE_CONFIG(printdialog);
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QPrinter;
|
class QPrinter;
|
||||||
|
class QPrintDevice;
|
||||||
class QPagePreview;
|
class QPagePreview;
|
||||||
|
|
||||||
class QPageSetupWidget : public QWidget {
|
class QPageSetupWidget : public QWidget {
|
||||||
@ -71,7 +72,8 @@ class QPageSetupWidget : public QWidget {
|
|||||||
public:
|
public:
|
||||||
explicit QPageSetupWidget(QWidget *parent = 0);
|
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;
|
void setupPrinter() const;
|
||||||
|
|
||||||
private slots:
|
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::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, outputFormat, printerName);
|
widget.pageSetup->setPrinter(printer, currentPrintDevice, outputFormat, printerName);
|
||||||
|
|
||||||
#if QT_CONFIG(cupsjobwidget)
|
#if QT_CONFIG(cupsjobwidget)
|
||||||
m_jobOptions = new QCupsJobWidget(printer, currentPrintDevice);
|
m_jobOptions = new QCupsJobWidget(printer, currentPrintDevice);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user