1 /****************************************************************************
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Copyright (C) 2016 Ivailo Monev
6 ** This file is part of the QtSql module of the Katie Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser
12 ** General Public License version 2.1 as published by the Free Software
13 ** Foundation and appearing in the file LICENSE.LGPL included in the
14 ** packaging of this file. Please review the following information to
15 ** ensure the GNU Lesser General Public License version 2.1 requirements
16 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
20 ****************************************************************************/
27 \class QSqlRelationalDelegate
28 \brief The QSqlRelationalDelegate class provides a delegate that is used to
29 display and edit data from a QSqlRelationalTableModel.
31 Unlike the default delegate, QSqlRelationalDelegate provides a
32 combobox for fields that are foreign keys into other tables. To
33 use the class, simply call QAbstractItemView::setItemDelegate()
34 on the view with an instance of QSqlRelationalDelegate:
36 \snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 4
38 The \l{sql/relationaltablemodel}{Relational Table Model} example
39 (shown below) illustrates how to use QSqlRelationalDelegate in
40 conjunction with QSqlRelationalTableModel to provide tables with
43 \image relationaltable.png
45 \sa QSqlRelationalTableModel, {Model/View Programming}
50 \fn QSqlRelationalDelegate::QSqlRelationalDelegate(QObject *parent)
52 Constructs a QSqlRelationalDelegate object with the given \a
57 \fn QSqlRelationalDelegate::~QSqlRelationalDelegate()
59 Destroys the QSqlRelationalDelegate object and frees any
64 \fn QWidget *QSqlRelationalDelegate::createEditor(QWidget *parent,
65 const QStyleOptionViewItem &option,
66 const QModelIndex &index) const
71 \fn void QSqlRelationalDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
76 \fn void QSqlRelationalDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
77 const QModelIndex &index) const