Skip to content
Permalink
Browse files

[layouts] Attempted fix for direct printing page orientation issues

Seems the earlier hack may no longer be valid for Qt5.

Fixes #18398, #18994, #19142, #19279

(cherry-picked from a87a7b7)
  • Loading branch information
nyalldawson committed Jul 30, 2018
1 parent 0b6fab6 commit 44332c14b849651c3e46793626d95bdd7a60db4d
Showing with 1 addition and 3 deletions.
  1. +1 −3 src/core/layout/qgslayoutexporter.cpp
@@ -1106,11 +1106,9 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::printPrivate( QPrinter &print

void QgsLayoutExporter::updatePrinterPageSize( QgsLayout *layout, QPrinter &printer, int page )
{
//must set orientation to portrait before setting paper size, otherwise size will be flipped
//for landscape sized outputs (#11352)
printer.setOrientation( QPrinter::Portrait );
QgsLayoutSize pageSize = layout->pageCollection()->page( page )->sizeWithUnits();
QgsLayoutSize pageSizeMM = layout->renderContext().measurementConverter().convert( pageSize, QgsUnitTypes::LayoutMillimeters );
printer.setOrientation( layout->pageCollection()->page( page )->orientation() == QgsLayoutItemPage::Portrait ? QPrinter::Portrait : QPrinter::Landscape );
printer.setPaperSize( pageSizeMM.toQSizeF(), QPrinter::Millimeter );
}

0 comments on commit 44332c1

Please sign in to comment.
You can’t perform that action at this time.