Skip to content

Commit

Permalink
Don't use deprecated QCoreApplication::hasPendingEvents method
Browse files Browse the repository at this point in the history
This was deprecated by qt for numerous reasons, but mostly because
it was totally misleading in a lot of circumstances.
  • Loading branch information
nyalldawson committed Feb 4, 2020
1 parent 859f741 commit 1f79485
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 39 deletions.
48 changes: 16 additions & 32 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2553,12 +2553,10 @@ void QgsLayoutDesignerDialog::printAtlas()
proxyTask->setProxyProgress( progress );

#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down Expand Up @@ -2737,12 +2735,10 @@ void QgsLayoutDesignerDialog::exportAtlasToRaster()
proxyTask->setProxyProgress( progress );

#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down Expand Up @@ -2894,12 +2890,10 @@ void QgsLayoutDesignerDialog::exportAtlasToSvg()
proxyTask->setProxyProgress( progress );

#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down Expand Up @@ -3108,12 +3102,10 @@ void QgsLayoutDesignerDialog::exportAtlasToPdf()
proxyTask->setProxyProgress( progress );

#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down Expand Up @@ -3243,12 +3235,10 @@ void QgsLayoutDesignerDialog::exportReportToRaster()
progressDialog->setLabelText( feedback->property( "progress" ).toString() ) ;

#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down Expand Up @@ -3361,12 +3351,10 @@ void QgsLayoutDesignerDialog::exportReportToSvg()
progressDialog->setLabelText( feedback->property( "progress" ).toString() ) ;

#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down Expand Up @@ -3498,12 +3486,10 @@ void QgsLayoutDesignerDialog::exportReportToPdf()
progressDialog->setLabelText( feedback->property( "progress" ).toString() ) ;

#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down Expand Up @@ -3605,12 +3591,10 @@ void QgsLayoutDesignerDialog::printReport()
progressDialog->setLabelText( feedback->property( "progress" ).toString() ) ;

#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down
5 changes: 2 additions & 3 deletions src/gui/processing/qgsprocessingalgorithmdialogbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,11 @@ void QgsProcessingAlgorithmDialogBase::processEvents()

// So that we get a chance of hitting the Abort button
#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down
6 changes: 2 additions & 4 deletions src/gui/qgsvaliditycheckresultswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,10 @@ bool QgsValidityCheckResultsWidget::runChecks( int type, const QgsValidityCheckC
proxyTask->setProxyProgress( progress );

#ifdef Q_OS_LINUX
// For some reason on Windows hasPendingEvents() always return true,
// but one iteration is actually enough on Windows to get good interactivity
// One iteration is actually enough on Windows to get good interactivity
// whereas on Linux we must allow for far more iterations.
// For safety limit the number of iterations
int nIters = 0;
while ( QCoreApplication::hasPendingEvents() && ++nIters < 100 )
while ( ++nIters < 100 )
#endif
{
QCoreApplication::processEvents();
Expand Down

0 comments on commit 1f79485

Please sign in to comment.