16#ifndef QgsQueryResultModel_H
17#define QgsQueryResultModel_H
19#include <QAbstractTableModel>
35class 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;
80class CORE_EXPORT QgsQueryResultModel :
public QAbstractTableModel
90 ~QgsQueryResultModel();
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 );
132 void fetchingComplete();
138 void fetchMoreRows( qlonglong maxRows );
143 void fetchingStarted();
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 QueryResult class represents the result of a query executed by execSql()