Obsolete Members for QSqlField

QSqlField 类的以下成员已被弃用。提供这些成员是为了确保旧源代码能够继续运行。我们强烈建议在新代码中不要使用它们。

公共函数

(deprecated in 6.0) QSqlField(const QString &fieldName, QVariant::Type type, const QString &table = QString())
(deprecated in 6.8) void setSqlType(int type)
(deprecated in 6.0) void setType(QVariant::Type type)
(deprecated in 6.0) QVariant::Type type() const
(deprecated in 6.8) int typeID() const

成员函数文档

[deprecated in 6.0] QSqlField::QSqlField(const QString &fieldName, QVariant::Type type, const QString &table = QString())

自 6.0 起,此函数已被废弃。我们强烈建议不要在新代码中使用它。

请改用接受QMetaType 作为参数的构造函数。

在table 中,创建一个名为fieldName 的空字段,其类型为变体type 。

这是一个重载函数。

[deprecated in 6.8] void QSqlField::setSqlType(int type)

自 6.8 版本起,该函数已被废弃。我们强烈建议不要在新代码中使用它。

此内部值已不再使用。

[deprecated in 6.0] void QSqlField::setType(QVariant::Type type)

自 6.0 起,此函数已被废弃。我们强烈建议不要在新代码中使用它。

请改用 `setMetaType()`。

将字段的变体类型设置为type 。

另请参阅 type() 和metaType 。

[deprecated in 6.0] QVariant::Type QSqlField::type() const

自 6.0 版本起,此函数已弃用。我们强烈建议不要在新代码中使用它。

请改用 `metaType()`。

返回该字段在数据库中存储的类型。请注意,实际值可能属于其他类型;对于过大而无法存储在 long int 或 double 中的数值,通常会以字符串形式存储,以防止精度损失。

另请参阅 setType() 和metaType 。

[deprecated in 6.8] int QSqlField::typeID() const

自 6.8 版本起,此函数已弃用。我们强烈建议不要在新代码中使用它。

此内部值已不再使用。

返回该字段的类型 ID。

如果返回值为负数,则表示数据库中无法获取该信息。

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