aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/querymodel.h
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2014-12-06 17:33:25 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2014-12-06 17:33:25 -0500
commit7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch)
treea35c14143716e1f2c98f808c81f89426045a946f /SQLiteStudio3/coreSQLiteStudio/querymodel.h
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/querymodel.h')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/querymodel.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/querymodel.h b/SQLiteStudio3/coreSQLiteStudio/querymodel.h
new file mode 100644
index 0000000..6c7e48a
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/querymodel.h
@@ -0,0 +1,42 @@
+#ifndef SQLQUERYMODEL_H
+#define SQLQUERYMODEL_H
+
+#include "db/sqlquery.h"
+#include "db/sqlresultsrow.h"
+#include <QList>
+#include <QAbstractTableModel>
+
+class Db;
+
+class API_EXPORT QueryModel : public QAbstractTableModel
+{
+ Q_OBJECT
+
+ public:
+ using QAbstractItemModel::fetchMore;
+ using QAbstractItemModel::canFetchMore;
+
+ QueryModel(Db* db, QObject *parent = nullptr);
+
+ virtual void refresh();
+ QVariant data(const QModelIndex& index, int role) const;
+ int rowCount(const QModelIndex& parent) const;
+ int columnCount(const QModelIndex& parent) const;
+
+ QString getQuery() const;
+ void setQuery(const QString& value);
+
+ private:
+ void fetchMore();
+ bool canFetchMore() const;
+
+ QString query;
+ Db* db = nullptr;
+ QList<SqlResultsRowPtr> loadedRows;
+ int columns = 0;
+
+ signals:
+ void refreshed();
+};
+
+#endif // SQLQUERYMODEL_H