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