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
  • Loading branch information
nyalldawson committed Jul 30, 2018
1 parent 40ce151 commit a87a7b72df6d3bbb71ac423cf61bf80a7de54354
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 a87a7b7

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