Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsqlrelationaldelegate.cpp
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
#
include
"qglobal.h"
6
7
QT_BEGIN_NAMESPACE
8
9
/*!
10
\class QSqlRelationalDelegate
11
\inmodule QtSql
12
\brief The QSqlRelationalDelegate class provides a delegate that is used to
13
display and edit data from a QSqlRelationalTableModel.
14
15
Unlike the default delegate, QSqlRelationalDelegate provides a
16
combobox for fields that are foreign keys into other tables. To
17
use the class, simply call QAbstractItemView::setItemDelegate()
18
on the view with an instance of QSqlRelationalDelegate:
19
20
\snippet relationaltablemodel/relationaltablemodel.cpp 4
21
22
The \l{relationaltablemodel}{Relational Table Model} example
23
(shown below) illustrates how to use QSqlRelationalDelegate in
24
conjunction with QSqlRelationalTableModel to provide tables with
25
foreign key support.
26
27
\image relationaltable.png {The user is able to edit a foreign key in a relational table}
28
29
\sa QSqlRelationalTableModel, {Model/View Programming}
30
*/
31
32
33
/*!
34
\fn QSqlRelationalDelegate::QSqlRelationalDelegate(QObject *parent)
35
36
Constructs a QSqlRelationalDelegate object with the given \a
37
parent.
38
*/
39
40
/*!
41
\fn QSqlRelationalDelegate::~QSqlRelationalDelegate()
42
43
Destroys the QSqlRelationalDelegate object and frees any
44
allocated resources.
45
*/
46
47
/*!
48
\fn QWidget *QSqlRelationalDelegate::createEditor(QWidget *parent,
49
const QStyleOptionViewItem &option,
50
const QModelIndex &index) const
51
\reimp
52
*/
53
54
/*!
55
\fn void QSqlRelationalDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
56
const QModelIndex &index) const
57
\reimp
58
*/
59
60
QT_END_NAMESPACE
QSqlRelationalDelegate
\inmodule QtSql
qtbase
src
sql
models
qsqlrelationaldelegate.cpp
Generated on
for Qt by
1.14.0