Make sure that printer page layout switched to millimeters before getting margins.
This commit is contained in:
parent
5e587591f0
commit
4fcbbc99fd
|
@ -973,7 +973,9 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
|
|||
qreal x,y;
|
||||
if(printer->fullPage())
|
||||
{
|
||||
QMarginsF printerMargins = printer->pageLayout().margins();
|
||||
QPageLayout layout = printer->pageLayout();
|
||||
layout.setUnits(QPageLayout::Millimeter);
|
||||
QMarginsF printerMargins = layout.margins();
|
||||
x = qFloor(ToPixel(printerMargins.left(),Unit::Mm));
|
||||
y = qFloor(ToPixel(printerMargins.top(),Unit::Mm));
|
||||
}
|
||||
|
|
|
@ -431,7 +431,9 @@ QRect VPoster::PageRect() const
|
|||
|
||||
if(printer->fullPage())
|
||||
{
|
||||
QMarginsF pMargins = printer->pageLayout().margins();
|
||||
QPageLayout layout = printer->pageLayout();
|
||||
layout.setUnits(QPageLayout::Millimeter);
|
||||
QMarginsF pMargins = layout.margins();
|
||||
QRectF newRect = rect.marginsRemoved(pMargins);
|
||||
const QRect pageRectFP(0, 0, qFloor(ToPixel(newRect.width())), qFloor(ToPixel(newRect.height())));
|
||||
return pageRectFP;
|
||||
|
|
Loading…
Reference in New Issue
Block a user