Skip to content
Permalink
Browse files

WFS provider: use QApplication instead of QgsApplication for use in s…

…tandalone applications
  • Loading branch information
rouault authored and nyalldawson committed Nov 18, 2020
1 parent bf44fdf commit 99ad537300993ecd4b9f2a3c94e7d55ffdc91297
@@ -766,7 +766,7 @@ bool QgsBackgroundCachedFeatureIterator::fetchFeature( QgsFeature &f )
mWaitCond.wait( &mMutex, timeout );
if ( requestMadeFromMainThread && mProcessEvents )
{
QgsApplication::instance()->processEvents();
QApplication::instance()->processEvents();
mProcessEvents = false;
}
if ( mInterruptionChecker && mInterruptionChecker->isCanceled() )
@@ -153,7 +153,7 @@ bool QgsBaseNetworkRequest::sendGET( const QUrl &url, const QString &acceptHeade

std::function<void()> downloaderFunction = [ this, request, synchronous, &waitConditionMutex, &waitCondition, &threadFinished, &success ]()
{
if ( QThread::currentThread() != QgsApplication::instance()->thread() )
if ( QThread::currentThread() != QApplication::instance()->thread() )
QgsNetworkAccessManager::instance( Qt::DirectConnection );

success = true;
@@ -229,7 +229,7 @@ bool QgsBaseNetworkRequest::sendGET( const QUrl &url, const QString &acceptHeade
{
waitConditionMutex.unlock();

QgsApplication::instance()->processEvents();
QApplication::instance()->processEvents();
// we don't need to wake up the worker thread - it will automatically be woken when
// the auth request has been dealt with by QgsNetworkAccessManager
}
@@ -16,7 +16,6 @@
***************************************************************************/

#include "qgis.h"
#include "qgsapplication.h"
#include "qgsfeature.h"
#include "qgsfields.h"
#include "qgsgeometry.h"
@@ -36,6 +35,7 @@
#include "qgswfsutils.h"
#include "qgssettings.h"

#include <QApplication>
#include <QDomDocument>
#include <QMessageBox>
#include <QDomNodeList>
@@ -131,7 +131,7 @@ QgsWFSProvider::QgsWFSProvider( const QString &uri, const ProviderOptions &optio
{
auto processEvents = []()
{
QgsApplication::instance()->processEvents();
QApplication::instance()->processEvents();
};
connect( downloader.get(), &QgsFeatureDownloader::resumeMainThread,
this, processEvents );

0 comments on commit 99ad537

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