QSqlRelation Class Reference

[ QtSql module]

The QSqlRelation class stores information about an SQL foreign key. 更多...

方法


详细描述

The QSqlRelation class stores information about an SQL foreign key.

QSqlRelation is a helper class for QSqlRelationalTableModel 。见 QSqlRelationalTableModel.setRelation () and QSqlRelationalTableModel.relation () 了解细节。


方法文档编制

QSqlRelation.__init__ ( self )

Constructs an invalid QSqlRelation 对象。

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

另请参阅 isValid ().

QSqlRelation.__init__ ( self , QString  aTableName , QString  indexCol , QString  displayCol )

构造 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.

另请参阅 tableName (), indexColumn (),和 displayColumn ().

QSqlRelation.__init__ ( self , QSqlRelation )

QString QSqlRelation.displayColumn ( self )

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

QString QSqlRelation.indexColumn ( self )

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

bool QSqlRelation.isValid ( self )

返回 true 若 QSqlRelation object is valid; otherwise returns false.

QString QSqlRelation.tableName ( self )

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