forked from pool/libqt5-qtbase
00088d9d89
OBS-URL: https://build.opensuse.org/request/show/572065 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=73
87 lines
4.0 KiB
Diff
87 lines
4.0 KiB
Diff
From ff67dedaaff2dc68571ca9c8c6c6eeaaf084eae4 Mon Sep 17 00:00:00 2001
|
|
From: Albert Astals Cid <albert.astals.cid@kdab.com>
|
|
Date: Wed, 6 Dec 2017 15:27:05 +0100
|
|
Subject: [PATCH 1/1] 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>
|
|
---
|
|
src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 9 +++++++--
|
|
src/printsupport/dialogs/qpagesetupdialog_unix_p.h | 4 +++-
|
|
src/printsupport/dialogs/qprintdialog_unix.cpp | 2 +-
|
|
3 files changed, 11 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
|
|
index 49c0184..6f3bb0d 100644
|
|
--- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
|
|
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
|
|
@@ -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)
|
|
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
|
|
index 44aca80..574569d 100644
|
|
--- a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
|
|
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
|
|
@@ -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 {
|
|
explicit QPageSetupWidget(QWidget *parent = 0);
|
|
explicit QPageSetupWidget(QPrinter *printer, 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:
|
|
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
|
|
index 020894c..22076bf 100644
|
|
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
|
|
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
|
|
@@ -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);
|
|
--
|
|
2.7.4
|
|
|