From 70081096a152d6973d85a1c1466bbc058fe0b24b Mon Sep 17 00:00:00 2001 From: John Layt Date: Mon, 27 Jan 2014 13:31:38 -0500 Subject: QPrintEngine - Switch Windows to QPageLayout Switch the Windows QPrintEngine to use QPageLayout. Change-Id: I2b617fe103980c4efbb0ed367547e436f2d8a5e2 Reviewed-by: Lars Knoll --- src/printsupport/kernel/qprintengine_win_p.h | 39 +++++++++------------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'src/printsupport/kernel/qprintengine_win_p.h') diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h index 61bf63346b..9b944d5921 100644 --- a/src/printsupport/kernel/qprintengine_win_p.h +++ b/src/printsupport/kernel/qprintengine_win_p.h @@ -129,12 +129,10 @@ public: mode(QPrinter::ScreenResolution), state(QPrinter::Idle), resolution(0), - pageMarginsSet(false), + m_pageLayout(QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0, 0, 0, 0))), num_copies(1), printToFile(false), - fullPage(false), - reinit(false), - has_custom_paper_size(false) + reinit(false) { } @@ -173,13 +171,9 @@ public: void strokePath_dev(const QPainterPath &path, const QColor &color, qreal width); void setPageSize(const QPageSize &pageSize); - void updatePageSize(); - - void updateOrigin(); - - void initDevRects(); - void setPageMargins(int margin_left, int margin_top, int margin_right, int margin_bottom); - QRect getPageMargins() const; + void updatePageLayout(); + void updateMetrics(); + void debugMetrics() const; // Windows GDI printer references. HANDLE hPrinter; @@ -205,21 +199,13 @@ public: int resolution; // Page Layout - QPageSize m_pageSize; - - // This QRect is used to store the exact values - // entered into the PageSetup Dialog because those are - // entered in mm but are since converted to device coordinates. - // If they were to be converted back when displaying the dialog - // again, there would be inaccuracies so when the user entered 10 - // it may show up as 9.99 the next time the dialog is opened. - // We don't want that confusion. - QRect previousDialogMargins; - - bool pageMarginsSet; - QRect devPageRect; - QRect devPhysicalPageRect; - QRect devPaperRect; + QPageLayout m_pageLayout; + + // Page metrics cache + QRect m_paintRectPixels; + QSize m_paintSizeMM; + + // Windows painting qreal stretch_x; qreal stretch_y; int origin_x; @@ -231,7 +217,6 @@ public: int num_copies; uint printToFile : 1; - uint fullPage : 1; uint reinit : 1; uint complex_xform : 1; -- cgit v1.2.3