Nesta página

QSqlRelation Class

A classe QSqlRelation armazena informações sobre uma chave estrangeira SQL. Mais...

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

Funções públicas

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

Descrição detalhada

QSqlRelation é uma classe auxiliar para ` QSqlRelationalTableModel`. Consulte ` QSqlRelationalTableModel::setRelation()` e ` QSqlRelationalTableModel::relation()` para obter detalhes.

Consulte também QSqlRelationalTableModel, QSqlRelationalDelegate e Exemplo de modelo de tabela relacional.

Documentação das funções de membro

QSqlRelation::QSqlRelation()

Cria um objeto QSqlRelation inválido.

Para tal objeto, as funções tableName(), indexColumn() e displayColumn() retornam uma string vazia.

Veja também isValid().

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

Cria um objeto QSqlRelation, em que tableName é o nome da tabela SQL à qual uma chave estrangeira se refere, indexColumn é a chave estrangeira e displayColumn é o campo que deve ser apresentado ao usuário.

Veja também tableName(), indexColumn() e displayColumn().

QString QSqlRelation::displayColumn() const

Retorna a coluna da tabela tableName() que deve ser exibida ao usuário em vez de uma chave estrangeira.

QString QSqlRelation::indexColumn() const

Retorna a coluna de índice da tabela tableName() à qual uma chave estrangeira se refere.

[noexcept] bool QSqlRelation::isValid() const

Retorna ` true ` se o objeto ` QSqlRelation ` for válido; caso contrário, retorna ` false`.

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

Troca essa relação por other. Essa operação é muito rápida e nunca falha.

QString QSqlRelation::tableName() const

Retorna o nome da tabela à qual uma chave estrangeira se refere.

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