Skip to content
Permalink
Browse files
Fix model signals not emitted when empty results
  • Loading branch information
elpaso committed Jul 6, 2021
1 parent 2fc4799 commit 537670a3a707d679cdfd8bdee78a5d444f3d03ec
Showing with 7 additions and 10 deletions.
  1. +7 −10 src/core/qgsqueryresultmodel.cpp
@@ -21,16 +21,13 @@ QgsQueryResultModel::QgsQueryResultModel( const QgsAbstractDatabaseProviderConne
, mColumns( queryResult.columns() )
{
qRegisterMetaType< QList<QList<QVariant>>>( "QList<QList<QVariant>>" );
if ( mQueryResult.hasNextRow() )
{
mWorker = new QgsQueryResultFetcher( &mQueryResult );
mWorker->moveToThread( &mWorkerThread );
connect( &mWorkerThread, &QThread::started, mWorker, &QgsQueryResultFetcher::fetchRows );
connect( mWorker, &QgsQueryResultFetcher::rowsReady, this, &QgsQueryResultModel::rowsReady );
// Forward signal
connect( mWorker, &QgsQueryResultFetcher::fetchingComplete, this, &QgsQueryResultModel::fetchingComplete );
mWorkerThread.start();
}
mWorker = new QgsQueryResultFetcher( &mQueryResult );
mWorker->moveToThread( &mWorkerThread );
connect( &mWorkerThread, &QThread::started, mWorker, &QgsQueryResultFetcher::fetchRows );
connect( mWorker, &QgsQueryResultFetcher::rowsReady, this, &QgsQueryResultModel::rowsReady );
// Forward signal
connect( mWorker, &QgsQueryResultFetcher::fetchingComplete, this, &QgsQueryResultModel::fetchingComplete );
mWorkerThread.start();
}

void QgsQueryResultModel::rowsReady( const QList<QList<QVariant>> &rows )

0 comments on commit 537670a

Please sign in to comment.