Nesta página

Alterações no Qt SQL

no Qt 6 são resultado de um esforço consciente para tornar a estrutura mais eficiente e fácil de usar.

Procuramos manter a compatibilidade binária e de código-fonte para todas as APIs públicas em cada versão. No entanto, algumas alterações foram inevitáveis no esforço de tornar o Qt um framework melhor.

Neste tópico, resumimos essas alterações no Qt SQL e fornecemos orientações para lidar com elas.

A classe QSqlQuery

Assinatura de `boundValues()`

O tipo de retorno de boundValues() foi alterado de QMap<QString, QVariant> para QVariantList. A ordem é confiável, portanto, seguirá a ordem da vinculação na consulta preparada. Altere o código da seguinte forma:

QMap<QString, QVariant> values = boundValues();
int id = values[":id"].value().toInt();
QList<QVariant> values = boundValues().values();
int id = values.at(0).toInt();

para:

QList<QVariant> values = boundValues().values();
int id = values.at(0).toInt();

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