diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-03-01 08:22:57 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-05 16:37:16 +0100 |
commit | e1ec8727ea94153ebdf2b06184de20901f1facb9 (patch) | |
tree | 4b0b581bac6ca1a6e8ad19cd16df97ec8af55e41 /src/printsupport | |
parent | 0cb58c7c6d0143b3ebb7527fccf74c750b9e32be (diff) |
Add API to convert QSizeF<->PaperSize in QPlatformPrinterSupport
These static public functions give printsupport plugins access to the
non-exported qt_paperSizeToQSizeF() and qSizeFTopaperSize() functions in
qprinter.cpp to aid implementing QPrintEngine and
QPlatformPrinterSupport::supportedPaperSizes().
Change-Id: I3ebcdcd17e863b06ceb135e096e630b37882a293
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/printsupport')
-rw-r--r-- | src/printsupport/kernel/qplatformprintersupport_qpa.cpp | 20 | ||||
-rw-r--r-- | src/printsupport/kernel/qplatformprintersupport_qpa.h | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/printsupport/kernel/qplatformprintersupport_qpa.cpp b/src/printsupport/kernel/qplatformprintersupport_qpa.cpp index aeb4599955..b6f65ee893 100644 --- a/src/printsupport/kernel/qplatformprintersupport_qpa.cpp +++ b/src/printsupport/kernel/qplatformprintersupport_qpa.cpp @@ -124,6 +124,26 @@ void QPlatformPrinterSupport::setPrinterInfoCupsPrinterIndex(QPrinterInfo *p, in #endif } +/* + Converts QSizeF in millimeters to a predefined PaperSize (returns Custom if + the size isn't a standard size) +*/ +QPrinter::PaperSize QPlatformPrinterSupport::convertQSizeFToPaperSize(const QSizeF &sizef) +{ + extern QPrinter::PaperSize qSizeFTopaperSize(const QSizeF &); + return qSizeFTopaperSize(sizef); +} + +/* + Converts a predefined PaperSize to a QSizeF in millimeters (returns + QSizeF(0.0, 0.0) if PaperSize is Custom) +*/ +QSizeF QPlatformPrinterSupport::convertPaperSizeToQSizeF(QPrinter::PaperSize paperSize) +{ + extern QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size); + return qt_paperSizeToQSizeF(paperSize); +} + QT_END_NAMESPACE #endif // QT_NO_PRINTER diff --git a/src/printsupport/kernel/qplatformprintersupport_qpa.h b/src/printsupport/kernel/qplatformprintersupport_qpa.h index 53f5900cce..5dba56579c 100644 --- a/src/printsupport/kernel/qplatformprintersupport_qpa.h +++ b/src/printsupport/kernel/qplatformprintersupport_qpa.h @@ -66,6 +66,9 @@ public: virtual QList<QPrinterInfo> availablePrinters(); virtual QPrinterInfo defaultPrinter(); + static QPrinter::PaperSize convertQSizeFToPaperSize(const QSizeF &sizef); + static QSizeF convertPaperSizeToQSizeF(QPrinter::PaperSize paperSize); + protected: static QPrinterInfo printerInfo(const QString &printerName, bool isDefault = false); static void setPrinterInfoDefault(QPrinterInfo *p, bool isDefault); |