Fixed issue #549. Printing fields ignored in paper length.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-08-22 11:25:06 +03:00
parent 9cd3fc8bcb
commit 134d683c72

View File

@ -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)
{