Skip to content

Commit

Permalink
[layouts] Attempted fix for direct printing page orientation issues
Browse files Browse the repository at this point in the history
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 31, 2018
1 parent 0b6fab6 commit 44332c1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/core/layout/qgslayoutexporter.cpp
Expand Up @@ -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 );
}

Expand Down

0 comments on commit 44332c1

Please sign in to comment.