Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qsqlquerymodel.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
ifndef
QSQLQUERYMODEL_H
6
#
define
QSQLQUERYMODEL_H
7
8
#
include
<
QtSql
/
qtsqlglobal
.
h
>
9
#
include
<
QtCore
/
qabstractitemmodel
.
h
>
10
#
include
<
QtSql
/
qsqldatabase
.
h
>
11
12
QT_REQUIRE_CONFIG
(
sqlmodel
);
13
14
QT_BEGIN_NAMESPACE
15
16
class
QSqlQueryModelPrivate;
17
class
QSqlError;
18
class
QSqlRecord;
19
class
QSqlQuery;
20
21
class
Q_SQL_EXPORT
QSqlQueryModel
:
public
QAbstractTableModel
22
{
23
Q_OBJECT
24
Q_DECLARE_PRIVATE(QSqlQueryModel)
25
26
public
:
27
explicit
QSqlQueryModel(QObject *parent =
nullptr
);
28
virtual
~QSqlQueryModel();
29
30
int
rowCount(
const
QModelIndex &parent = QModelIndex())
const
override;
31
int
columnCount(
const
QModelIndex &parent = QModelIndex())
const
override;
32
QSqlRecord record(
int
row)
const
;
33
QSqlRecord record()
const
;
34
35
QVariant data(
const
QModelIndex &item,
int
role = Qt::DisplayRole)
const
override;
36
QVariant headerData(
int
section, Qt::Orientation orientation,
37
int
role = Qt::DisplayRole)
const
override;
38
bool
setHeaderData(
int
section, Qt::Orientation orientation,
const
QVariant &value,
39
int
role = Qt::EditRole) override;
40
41
bool
insertColumns(
int
column,
int
count,
const
QModelIndex &parent = QModelIndex()) override;
42
bool
removeColumns(
int
column,
int
count,
const
QModelIndex &parent = QModelIndex()) override;
43
44
#
if
QT_REMOVAL_QT7_DEPRECATED_SINCE
(
6
,
2
)
45
QT_DEPRECATED_VERSION_X_6_2(
"QSqlQuery is not meant to be copied. Pass it by move instead."
)
46
void
setQuery(
const
QSqlQuery &query);
47
#
endif
48
void
setQuery(QSqlQuery &&query);
49
void
setQuery(
const
QString &query,
const
QSqlDatabase &db = QSqlDatabase());
50
void
refresh();
51
#
if
QT_SQL_REMOVED_SINCE
(
6
,
5
)
52
QSqlQuery query()
const
;
53
#
endif
54
const
QSqlQuery &query(QT6_DECL_NEW_OVERLOAD)
const
;
55
56
virtual
void
clear();
57
58
QSqlError lastError()
const
;
59
60
void
fetchMore(
const
QModelIndex &parent = QModelIndex()) override;
61
bool
canFetchMore(
const
QModelIndex &parent = QModelIndex())
const
override;
62
63
QHash<
int
, QByteArray> roleNames()
const
override;
64
65
protected
:
66
void
beginInsertRows(
const
QModelIndex &parent,
int
first,
int
last);
67
void
endInsertRows();
68
69
void
beginRemoveRows(
const
QModelIndex &parent,
int
first,
int
last);
70
void
endRemoveRows();
71
72
void
beginInsertColumns(
const
QModelIndex &parent,
int
first,
int
last);
73
void
endInsertColumns();
74
75
void
beginRemoveColumns(
const
QModelIndex &parent,
int
first,
int
last);
76
void
endRemoveColumns();
77
78
void
beginResetModel();
79
void
endResetModel();
80
virtual
void
queryChange();
81
82
virtual
QModelIndex indexInQuery(
const
QModelIndex &item)
const
;
83
void
setLastError(
const
QSqlError &error);
84
QSqlQueryModel(QSqlQueryModelPrivate &dd, QObject *parent =
nullptr
);
85
};
86
87
QT_END_NAMESPACE
88
89
#
endif
// QSQLQUERYMODEL_H
QSqlQueryModel
The QSqlQueryModel class provides a read-only data model for SQL result sets.
Definition
qsqlquerymodel.h:22
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QSQL_PREFETCH
#define QSQL_PREFETCH
Definition
qsqlquerymodel.cpp:16
QT_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(sqlmodel)
qtbase
src
sql
models
qsqlquerymodel.h
Generated on
for Qt by
1.18.0