From 134d683c72ec469f63524527f172c0e091d8667d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 22 Aug 2016 11:25:06 +0300 Subject: [PATCH] Fixed issue #549. Printing fields ignored in paper length. --HG-- branch : develop --- src/app/valentina/mainwindowsnogui.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 0c478f573..fab419219 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -916,6 +916,11 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr printer->setOrientation(QPrinter::Landscape); } + const qreal left = FromPixel(margins.left(), Unit::Mm); + const qreal top = FromPixel(margins.top(), Unit::Mm); + const qreal right = FromPixel(margins.right(), Unit::Mm); + const qreal bottom = FromPixel(margins.bottom(), Unit::Mm); + if (not isTiled) { QSizeF size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paperSize.height(), Unit::Mm)); @@ -931,6 +936,8 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr const QPrinter::PageSize pSZ = FindTemplate(size); if (pSZ == QPrinter::Custom) { + size.setWidth(size.width() + left + right); + size.setHeight(size.height() + top + bottom); printer->setPaperSize (size, QPrinter::Millimeter ); } else @@ -939,13 +946,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr } } - { - const qreal left = FromPixel(margins.left(), Unit::Mm); - const qreal top = FromPixel(margins.top(), Unit::Mm); - const qreal right = FromPixel(margins.right(), Unit::Mm); - const qreal bottom = FromPixel(margins.bottom(), Unit::Mm); - printer->setPageMargins(left, top, right, bottom, QPrinter::Millimeter); - } + printer->setPageMargins(left, top, right, bottom, QPrinter::Millimeter); switch(printType) {