QSqlRelation Class

Die Klasse QSqlRelation speichert Informationen über einen SQL-Fremdschlüssel. Mehr...

Kopfzeile: #include <QSqlRelation>
CMake: find_package(Qt6 REQUIRED COMPONENTS Sql)
target_link_libraries(mytarget PRIVATE Qt6::Sql)
qmake: QT += sql

Öffentliche Funktionen

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

Detaillierte Beschreibung

QSqlRelation ist eine Hilfsklasse für QSqlRelationalTableModel. Siehe QSqlRelationalTableModel::setRelation() und QSqlRelationalTableModel::relation() für Details.

Siehe auch QSqlRelationalTableModel, QSqlRelationalDelegate, und Relationales Tabellenmodell Beispiel.

Dokumentation der Mitgliedsfunktionen

QSqlRelation::QSqlRelation()

Konstruiert ein ungültiges QSqlRelation-Objekt.

Für ein solches Objekt geben die Funktionen tableName(), indexColumn() und displayColumn() einen leeren String zurück.

Siehe auch isValid().

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

Konstruiert ein QSqlRelation-Objekt, wobei tableName der SQL-Tabellenname ist, auf den sich ein Fremdschlüssel bezieht, indexColumn der Fremdschlüssel und displayColumn das Feld ist, das dem Benutzer angezeigt werden soll.

Siehe auch tableName(), indexColumn(), und displayColumn().

QString QSqlRelation::displayColumn() const

Gibt die Spalte aus der Tabelle tableName() zurück, die dem Benutzer anstelle eines Fremdschlüssels angezeigt werden soll.

QString QSqlRelation::indexColumn() const

Gibt die Indexspalte aus der Tabelle tableName() zurück, auf die sich ein Fremdschlüssel bezieht.

[noexcept] bool QSqlRelation::isValid() const

Gibt true zurück, wenn das Objekt QSqlRelation gültig ist; andernfalls wird false zurückgegeben.

[noexcept] void QSqlRelation::swap(QSqlRelation &other)

Tauscht diese Beziehung mit other aus. Dieser Vorgang ist sehr schnell und schlägt nie fehl.

QString QSqlRelation::tableName() const

Gibt den Namen der Tabelle zurück, auf die sich ein Fremdschlüssel bezieht.

© 2025 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.