CopperSpice API  1.7.2
QSqlRelation Class Reference

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

Public Methods

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

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

Constructor & Destructor Documentation

QSqlRelation::QSqlRelation ( )
inline

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 
)
inline

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(), displayColumn()

Method Documentation

QString QSqlRelation::displayColumn ( ) const
inline

Returns the column from table tableName() that should be presented to the user instead of a foreign key.

QString QSqlRelation::indexColumn ( ) const
inline

Returns the index column from table tableName() to which a foreign key refers.

bool QSqlRelation::isValid ( ) const
inline

Returns true if the QSqlRelation object is valid, otherwise returns false.

QString QSqlRelation::tableName ( ) const
inline

Returns the name of the table to which a foreign key refers.