The QSqlRelation class stores information about an SQL foreign key. 更多...
头: | #include <QSqlRelation> |
qmake: | QT += sql |
QSqlRelation (const QString & tableName , const QString & indexColumn , const QString & displayColumn ) | |
QSqlRelation () | |
QString | displayColumn () const |
QString | indexColumn () const |
bool | isValid () const |
void | swap (QSqlRelation & other ) |
QString | tableName () const |
QSqlRelation is a helper class for QSqlRelationalTableModel 。见 QSqlRelationalTableModel::setRelation () 和 QSqlRelationalTableModel::relation () 了解细节。
另请参阅 QSqlRelationalTableModel , QSqlRelationalDelegate ,和 关系表模型范例 .
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.
另请参阅 tableName (), indexColumn (),和 displayColumn ().
Constructs an invalid QSqlRelation object.
For such an object, the tableName (), indexColumn (),和 displayColumn () functions return an empty string.
另请参阅 isValid ().
Returns the column from table tableName () that should be presented to the user instead of a foreign key.
Returns the index column from table tableName () to which a foreign key refers.
返回
true
若
QSqlRelation
object is valid; otherwise returns
false
.
交换
this
with
other
.
Returns the name of the table to which a foreign key refers.