Skip to content
Permalink
Browse files

Run WFS feature counter task in separate thread

  • Loading branch information
m-kuhn committed May 23, 2018
1 parent 365fbed commit 9b5c5b0081e2cc4baedee428a248485d418655ea
Showing with 21 additions and 4 deletions.
  1. +21 −4 src/providers/wfs/qgswfsrequest.cpp
@@ -24,6 +24,8 @@
#include <QEventLoop>
#include <QNetworkCacheMetaData>
#include <QCryptographicHash> // just for testin file:// fake_qgis_http_endpoint hack
#include <QFuture>
#include <QtConcurrent>

const qint64 READ_BUFFER_SIZE_HINT = 1024 * 1024;

@@ -140,12 +142,27 @@ bool QgsWfsRequest::sendGET( const QUrl &url, bool synchronous, bool forceRefres

if ( !synchronous )
return true;
else
{
QEventLoop loop;
connect( this, &QgsWfsRequest::downloadFinished, &loop, &QEventLoop::quit );

QEventLoop loop;
connect( this, &QgsWfsRequest::downloadFinished, &loop, &QEventLoop::quit );
loop.exec( QEventLoop::ExcludeUserInputEvents );
if ( QThread::currentThread() == QApplication::instance()->thread() )
{
QFuture<void> future = QtConcurrent::run( [ &loop ]()
{
loop.exec();
} );

return mErrorMessage.isEmpty();
future.waitForFinished();
}
else
{
loop.exec();
}

return mErrorMessage.isEmpty();
}
}

bool QgsWfsRequest::sendPOST( const QUrl &url, const QString &contentTypeHeader, const QByteArray &data )

0 comments on commit 9b5c5b0

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