4#ifndef QSQLRELATIONALDELEGATE_H
5#define QSQLRELATIONALDELEGATE_H
7#include <QtSql/qtsqlglobal.h>
13#include <QtWidgets/qstyleditemdelegate.h>
14#if QT_CONFIG(listview)
15#include <QtWidgets/qlistview.h>
17#if QT_CONFIG(combobox)
18#include <QtWidgets/qcombobox.h>
20#include <QtSql/qsqldriver.h>
21#include <QtSql/qsqlrelationaltablemodel.h>
22#include <QtCore/qmetaobject.h>
47 const QStyleOptionViewItem &
option,
70 if (qobject_cast<QComboBox *>(editor)) {
93 QComboBox *combo = qobject_cast<QComboBox *>(editor);
94 if (!sqlModel || !childModel || !combo) {
101 int childColIndex = fieldIndex(childModel, driver,
103 int childEditIndex = fieldIndex(childModel, driver,
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the data in row and column with parent.
The QComboBox widget is a combined button and popup list.
void setModelColumn(int visibleColumn)
virtual void setModel(QAbstractItemModel *model)
Sets the model to be model.
int currentIndex
the index of the current item in the combobox.
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
QSqlDriver * driver() const
Returns the database driver used to access the database connection.
The QSqlDriver class is an abstract base class for accessing specific SQL databases.
virtual QString stripDelimiters(const QString &identifier, IdentifierType type) const
Returns the identifier with the leading and trailing delimiters removed, identifier can either be a t...
virtual bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const
Returns whether identifier is escaped according to the database rules.
QString indexColumn() const
Returns the index column from table tableName() to which a foreign key refers.
QString displayColumn() const
Returns the column from table tableName() that should be presented to the user instead of a foreign k...
The QSqlRelationalTableModel class provides an editable data model for a single database table,...
QSqlRelation relation(int column) const
Returns the relation for the column column, or an invalid relation if no relation is set.
virtual QSqlTableModel * relationModel(int column) const
Returns a QSqlTableModel object for accessing the table for which column is a foreign key,...
bool setData(const QModelIndex &item, const QVariant &value, int role=Qt::EditRole) override
Sets the data for the role in the item with the specified index to the value given.
The QSqlTableModel class provides an editable data model for a single database table.
QVariant data(const QModelIndex &idx, int role=Qt::DisplayRole) const override
\reimp
QSqlDatabase database() const
Returns the model's database connection.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QStyledItemDelegate class provides display and editing facilities for data items from a model.
void setEditorData(QWidget *editor, const QModelIndex &index) const override
Sets the data to be displayed and edited by the editor from the data model item specified by the mode...
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
Gets data from the editor widget and stores it in the specified model at the item index.
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Returns the widget used to edit the item specified by index for editing.
void * data()
Returns a pointer to the contained object as a generic void* that can be written to.
Combined button and popup list for selecting options.
static glyph_t stripped(glyph_t glyph)
GLsizei const GLfloat * v
[13]
#define QT_REQUIRE_CONFIG(feature)
QSqlQueryModel * model
[16]