Skip to content
Permalink
Browse files

[layouts] Set printer document name when printing layouts

Makes for better display in desktop print job queues
  • Loading branch information
nyalldawson committed Aug 26, 2018
1 parent 14f36f2 commit 46356c848b31d47d97941d4a22e49635326983d1
Showing with 12 additions and 6 deletions.
  1. +12 −6 src/app/layout/qgslayoutdesignerdialog.cpp
@@ -1769,7 +1769,9 @@ void QgsLayoutDesignerDialog::print()

QgsLayoutExporter exporter( mLayout );
QString printerName = printer()->printerName();
QgsLayoutExporter::ExportResult result = exporter.print( *printer(), printSettings );
QPrinter *p = printer();
p->setDocName( mMasterLayout->name() );
QgsLayoutExporter::ExportResult result = exporter.print( *p, printSettings );

proxyTask->finalize( result == QgsLayoutExporter::Success );

@@ -1780,7 +1782,7 @@ void QgsLayoutDesignerDialog::print()
QString message;
if ( !printerName.isEmpty() )
{
message = tr( "Successfully printed layout to %1." ).arg( printerName );
message = tr( "Successfully printed layout to %1." ).arg( printerName );
}
else
{
@@ -2381,8 +2383,10 @@ void QgsLayoutDesignerDialog::printAtlas()

QgsApplication::taskManager()->addTask( proxyTask );

QString printerName = printer()->printerName();
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::print( printAtlas, *printer(), printSettings, error, feedback.get() );
QPrinter *p = printer();
p->setDocName( mMasterLayout->name() );
QString printerName = p->printerName();
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::print( printAtlas, *p, printSettings, error, feedback.get() );

proxyTask->finalize( result == QgsLayoutExporter::Success );

@@ -3428,8 +3432,10 @@ void QgsLayoutDesignerDialog::printReport()

QgsApplication::taskManager()->addTask( proxyTask );

QString printerName = printer()->printerName();
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::print( static_cast< QgsReport * >( mMasterLayout ), *printer(), printSettings, error, feedback.get() );
QPrinter *p = printer();
QString printerName = p->printerName();
p->setDocName( mMasterLayout->name() );
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::print( static_cast< QgsReport * >( mMasterLayout ), *p, printSettings, error, feedback.get() );

proxyTask->finalize( result == QgsLayoutExporter::Success );

0 comments on commit 46356c8

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