Skip to content
Permalink
Browse files

Fix progress bar with report export

  • Loading branch information
nyalldawson committed Dec 30, 2017
1 parent 8eb6aa9 commit 17292c12e9f7d3b52f658985712feed9d7c2fc49
Showing with 26 additions and 13 deletions.
  1. +9 −9 src/app/layout/qgslayoutdesignerdialog.cpp
  2. +17 −4 src/core/layout/qgslayoutexporter.cpp
@@ -2631,11 +2631,11 @@ void QgsLayoutDesignerDialog::exportReportToRaster()

QString error;
std::unique_ptr< QgsFeedback > feedback = qgis::make_unique< QgsFeedback >();
std::unique_ptr< QProgressDialog > progressDialog = qgis::make_unique< QProgressDialog >( tr( "Rendering report..." ), tr( "Abort" ), 0, 100, this );
std::unique_ptr< QProgressDialog > progressDialog = qgis::make_unique< QProgressDialog >( tr( "Rendering report..." ), tr( "Abort" ), 0, 0, this );
progressDialog->setWindowTitle( tr( "Exporting Report" ) );
connect( feedback.get(), &QgsFeedback::progressChanged, this, [ & ]( double progress )
connect( feedback.get(), &QgsFeedback::progressChanged, this, [ & ]( double )
{
progressDialog->setValue( progress );
//progressDialog->setValue( progress );
progressDialog->setLabelText( feedback->property( "progress" ).toString() ) ;

#ifdef Q_OS_LINUX
@@ -2746,11 +2746,11 @@ void QgsLayoutDesignerDialog::exportReportToSvg()

QString error;
std::unique_ptr< QgsFeedback > feedback = qgis::make_unique< QgsFeedback >();
std::unique_ptr< QProgressDialog > progressDialog = qgis::make_unique< QProgressDialog >( tr( "Rendering maps..." ), tr( "Abort" ), 0, 100, this );
std::unique_ptr< QProgressDialog > progressDialog = qgis::make_unique< QProgressDialog >( tr( "Rendering maps..." ), tr( "Abort" ), 0, 0, this );
progressDialog->setWindowTitle( tr( "Exporting Report" ) );
connect( feedback.get(), &QgsFeedback::progressChanged, this, [ & ]( double progress )
connect( feedback.get(), &QgsFeedback::progressChanged, this, [ & ]( double )
{
progressDialog->setValue( progress );
//progressDialog->setValue( progress );
progressDialog->setLabelText( feedback->property( "progress" ).toString() ) ;

#ifdef Q_OS_LINUX
@@ -2880,11 +2880,11 @@ void QgsLayoutDesignerDialog::exportReportToPdf()

QString error;
std::unique_ptr< QgsFeedback > feedback = qgis::make_unique< QgsFeedback >();
std::unique_ptr< QProgressDialog > progressDialog = qgis::make_unique< QProgressDialog >( tr( "Rendering maps..." ), tr( "Abort" ), 0, 100, this );
std::unique_ptr< QProgressDialog > progressDialog = qgis::make_unique< QProgressDialog >( tr( "Rendering maps..." ), tr( "Abort" ), 0, 0, this );
progressDialog->setWindowTitle( tr( "Exporting Report" ) );
connect( feedback.get(), &QgsFeedback::progressChanged, this, [ & ]( double progress )
connect( feedback.get(), &QgsFeedback::progressChanged, this, [ & ]( double )
{
progressDialog->setValue( progress );
//progressDialog->setValue( progress );
progressDialog->setLabelText( feedback->property( "progress" ).toString() ) ;

#ifdef Q_OS_LINUX
@@ -410,7 +410,10 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToImage( QgsAbstractLay
{
if ( feedback )
{
feedback->setProperty( "progress", QObject::tr( "Exporting %1 of %2" ).arg( i + 1 ).arg( total ) );
if ( total > 0 )
feedback->setProperty( "progress", QObject::tr( "Exporting %1 of %2" ).arg( i + 1 ).arg( total ) );
else
feedback->setProperty( "progress", QObject::tr( "Exporting section %1" ).arg( i + 1 ).arg( total ) );
feedback->setProgress( step * i );
}
if ( feedback && feedback->isCanceled() )
@@ -505,7 +508,10 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( QgsAbstractLayou
{
if ( feedback )
{
feedback->setProperty( "progress", QObject::tr( "Exporting %1 of %2" ).arg( i + 1 ).arg( total ) );
if ( total > 0 )
feedback->setProperty( "progress", QObject::tr( "Exporting %1 of %2" ).arg( i + 1 ).arg( total ) );
else
feedback->setProperty( "progress", QObject::tr( "Exporting section %1" ).arg( i + 1 ).arg( total ) );
feedback->setProgress( step * i );
}
if ( feedback && feedback->isCanceled() )
@@ -579,7 +585,10 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdfs( QgsAbstractLayo
{
if ( feedback )
{
feedback->setProperty( "progress", QObject::tr( "Exporting %1 of %2" ).arg( i + 1 ).arg( total ) );
if ( total > 0 )
feedback->setProperty( "progress", QObject::tr( "Exporting %1 of %2" ).arg( i + 1 ).arg( total ) );
else
feedback->setProperty( "progress", QObject::tr( "Exporting section %1" ).arg( i + 1 ).arg( total ) );
feedback->setProgress( step * i );
}
if ( feedback && feedback->isCanceled() )
@@ -792,7 +801,11 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToSvg( QgsAbstractLayou
{
if ( feedback )
{
feedback->setProperty( "progress", QObject::tr( "Exporting %1 of %2" ).arg( i + 1 ).arg( total ) );
if ( total > 0 )
feedback->setProperty( "progress", QObject::tr( "Exporting %1 of %2" ).arg( i + 1 ).arg( total ) );
else
feedback->setProperty( "progress", QObject::tr( "Exporting section %1" ).arg( i + 1 ).arg( total ) );

feedback->setProgress( step * i );
}
if ( feedback && feedback->isCanceled() )

0 comments on commit 17292c1

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