Skip to content

Commit 534e1bc

Browse files
author
mhugent
committed
Initialize portrait / landscape in print dialog based on composition width and height. Fixes bug #2080
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12101 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 2dca1cb commit 534e1bc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/app/composer/qgscomposer.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,20 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
453453
void QgsComposer::on_mActionPrint_triggered()
454454
{
455455
QPrinter printer;
456+
//portrait or landscape
457+
if ( mComposition )
458+
{
459+
if ( mComposition->paperWidth() >= mComposition->paperHeight() )
460+
{
461+
printer.setOrientation( QPrinter::Landscape );
462+
}
463+
else
464+
{
465+
printer.setOrientation( QPrinter::Portrait );
466+
}
467+
}
468+
QPrintDialog printDialog( &printer, 0 );
456469

457-
QPrintDialog printDialog( &printer );
458470
if ( printDialog.exec() != QDialog::Accepted )
459471
return;
460472

0 commit comments

Comments
 (0)