QSqlRelation Class
QSqlRelation クラスは、SQL の外部キーに関する情報を格納します。詳細...
| ヘッダー: | #include <QSqlRelation> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Sql) target_link_libraries(mytarget PRIVATE Qt6::Sql) |
| qmake: | QT += sql |
パブリック関数
| QSqlRelation() | |
| QSqlRelation(const QString &tableName, const QString &indexColumn, const QString &displayColumn) | |
| QString | displayColumn() const |
| QString | indexColumn() const |
| bool | isValid() const |
| void | swap(QSqlRelation &other) |
| QString | tableName() const |
詳細な説明
QSqlRelation は、QSqlRelationalTableModel のヘルパークラスです。詳細については、QSqlRelationalTableModel::setRelation() およびQSqlRelationalTableModel::relation() を参照してください。
QSqlRelationalTableModel 、QSqlRelationalDelegate 、および「リレーショナル・テーブル・モデルの例」も参照してください 。
メンバ関数のドキュメント
QSqlRelation::QSqlRelation()
無効な QSqlRelation オブジェクトを生成します。
このようなオブジェクトの場合、tableName()、indexColumn()、およびdisplayColumn() 関数は空の文字列を返します。
isValid()も参照してください 。
QSqlRelation::QSqlRelation(const QString &tableName, const QString &indexColumn, const QString &displayColumn)
QSqlRelation オブジェクトを生成します。ここで、tableName は外部キーが参照する SQL テーブル名、indexColumn は外部キー、displayColumn はユーザーに表示されるべきフィールドです。
tableName()、indexColumn()、およびdisplayColumn()も参照してください 。
QString QSqlRelation::displayColumn() const
tableName() テーブルの中から、外部キーの代わりにユーザーに表示すべき列を返します。
QString QSqlRelation::indexColumn() const
テーブル `tableName()` において、外部キーが参照するインデックス列を返します。
[noexcept] bool QSqlRelation::isValid() const
QSqlRelation オブジェクトが有効な場合はtrue を返し、そうでない場合はfalse を返します。
[noexcept] void QSqlRelation::swap(QSqlRelation &other)
この関係をother に置き換えます。この操作は非常に高速で、失敗することはありません。
QString QSqlRelation::tableName() const
外部キーが参照するテーブルの名前を返します。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.