QSqlRelation Class

The QSqlRelation class stores information about an SQL foreign key. More...

Header: #include <QSqlRelation>
qmake: QT += sql

Public Functions

QSqlRelation()
QSqlRelation(const QString &tableName, const QString &indexColumn, const QString &displayColumn)

Detailed Description

The QSqlRelation class stores information about an SQL foreign key.

QSqlRelation is a helper class for QSqlRelationalTableModel. See QSqlRelationalTableModel::setRelation() and QSqlRelationalTableModel::relation() for details.

See also QSqlRelationalTableModel, QSqlRelationalDelegate, and Relational Table Model Example.

Member Function Documentation

QSqlRelation::QSqlRelation()

Constructs an invalid QSqlRelation object.

For such an object, the tableName(), indexColumn(), and displayColumn() functions return an empty string.

See also isValid().

QSqlRelation::QSqlRelation(const QString &tableName, const QString &indexColumn, const QString &displayColumn)

Constructs a QSqlRelation object, where tableName is the SQL table name to which a foreign key refers, indexColumn is the foreign key, and displayColumn is the field that should be presented to the user.

See also tableName(), indexColumn(), and displayColumn().