16 #ifndef QgsQueryResultModel_H 
   17 #define QgsQueryResultModel_H 
   19 #include <QAbstractTableModel> 
   22 #include "qgis_core.h" 
   35 class QgsQueryResultFetcher: 
public QObject
 
   43       : mQueryResult( queryResult )
 
   47     void fetchRows( 
long long maxRows = -1 );
 
   55     void rowsReady( 
const QList<QList<QVariant>> &newRows );
 
   58     void fetchingComplete();
 
   63     QAtomicInt mStopFetching = 0;
 
   65     static const int ROWS_BATCH_COUNT;
 
   95     int rowCount( 
const QModelIndex &parent ) 
const override;
 
   96     int columnCount( 
const QModelIndex &parent ) 
const override;
 
   97     QVariant data( 
const QModelIndex &index, 
int role ) 
const override;
 
   98     QVariant headerData( 
int section, Qt::Orientation orientation, 
int role ) 
const override;
 
  100     void fetchMore( 
const QModelIndex &parent ) 
override;
 
  101     bool canFetchMore( 
const QModelIndex &parent ) 
const override;
 
  104     QStringList columns() 
const;
 
  117     void rowsReady( 
const QList<QList<QVariant> > &rows );
 
  148     QStringList mColumns;
 
  149     QThread mWorkerThread;
 
  150     std::unique_ptr<QgsQueryResultFetcher> mWorker;
 
  151     QList<QVariantList> mRows;
 
  154     static const int FETCH_MORE_ROWS_COUNT;
 
The QgsQueryResultModel class is a model for QgsAbstractDatabaseProviderConnection::QueryResult.
void fetchingStarted()
Emitted when fetching of rows has started.
void fetchMoreRows(qlonglong maxRows)
Emitted when more rows are requested.
void fetchingComplete()
Emitted when rows have been fetched (all of them or a batch if maxRows was passed to fetchMoreRows() ...
The QueryResult class represents the result of a query executed by execSql()