Skip to content

Commit

Permalink
[layouts] Set printer document name when printing layouts
Browse files Browse the repository at this point in the history
Makes for better display in desktop print job queues

(cherry picked from commit 46356c8)
  • Loading branch information
nyalldawson committed Aug 27, 2018
1 parent 96cf972 commit 2e42525
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Expand Up @@ -1765,7 +1765,9 @@ void QgsLayoutDesignerDialog::print()

QgsLayoutExporter exporter( mLayout );
QString printerName = printer()->printerName();
switch ( exporter.print( *printer(), printSettings ) )
QPrinter *p = printer();
p->setDocName( mMasterLayout->name() );
switch ( exporter.print( *p, printSettings ) )
{
case QgsLayoutExporter::Success:
{
Expand Down Expand Up @@ -2348,8 +2350,10 @@ void QgsLayoutDesignerDialog::printAtlas()
feedback->cancel();
} );

QString printerName = printer()->printerName();
switch ( QgsLayoutExporter::print( printAtlas, *printer(), printSettings, error, feedback.get() ) )
QPrinter *p = printer();
p->setDocName( mMasterLayout->name() );
QString printerName = p->printerName();
switch ( QgsLayoutExporter::print( printAtlas, *p, printSettings, error, feedback.get() ) )
{
case QgsLayoutExporter::Success:
{
Expand Down Expand Up @@ -3346,8 +3350,10 @@ void QgsLayoutDesignerDialog::printReport()
feedback->cancel();
} );

QString printerName = printer()->printerName();
switch ( QgsLayoutExporter::print( static_cast< QgsReport * >( mMasterLayout ), *printer(), printSettings, error, feedback.get() ) )
QPrinter *p = printer();
QString printerName = p->printerName();
p->setDocName( mMasterLayout->name() );
switch ( QgsLayoutExporter::print( static_cast< QgsReport * >( mMasterLayout ), *p, printSettings, error, feedback.get() ) )
{
case QgsLayoutExporter::Success:
{
Expand Down

0 comments on commit 2e42525

Please sign in to comment.