Skip to content

Commit 44332c1

Browse files
committed
[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)
1 parent 0b6fab6 commit 44332c1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/core/layout/qgslayoutexporter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,11 +1106,9 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::printPrivate( QPrinter &print
11061106

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

0 commit comments

Comments
 (0)