QSqlIndex Class
QSqlIndex 类提供了用于操作和描述数据库索引的函数。更多内容...
| 头文件: | #include <QSqlIndex> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Sql) target_link_libraries(mytarget PRIVATE Qt6::Sql) |
| qmake: | QT += sql |
| 继承自: | QSqlRecord |
- 所有成员列表(包括继承的成员)
- QSqlIndex 属于数据库类。
属性
(since 6.8)cursorName : QString(since 6.8)name : QString
公共函数
| QSqlIndex(const QString &cursorname = QString(), const QString &name = QString()) | |
| QSqlIndex(const QSqlIndex &other) | |
(since 6.6) | QSqlIndex(QSqlIndex &&other) |
| ~QSqlIndex() | |
| void | append(const QSqlField &field) |
| void | append(const QSqlField &field, bool desc) |
| QString | cursorName() const |
| bool | isDescending(int i) const |
| QString | name() const |
| void | setCursorName(const QString &cursorName) |
| void | setDescending(int i, bool desc) |
| void | setName(const QString &name) |
(since 6.6) QSqlIndex & | operator=(QSqlIndex &&other) |
| QSqlIndex & | operator=(const QSqlIndex &other) |
属性文档
[since 6.8] cursorName : QString
该属性存储与该索引关联的光标名称。
该枚举在 Qt 6.8 中引入。
访问函数:
| QString | cursorName() const |
| void | setCursorName(const QString &cursorName) |
[since 6.8] name : QString
该属性存储索引的名称。
该枚举在 Qt 6.8 中引入。
访问函数:
成员函数文档
[explicit] QSqlIndex::QSqlIndex(const QString &cursorname = QString(), const QString &name = QString())
使用游标名cursorname 和索引名name 创建一个空索引。
QSqlIndex::QSqlIndex(const QSqlIndex &other)
创建other 的副本。
[noexcept default, since 6.6] QSqlIndex::QSqlIndex(QSqlIndex &&other)
从 `other` 移动构造一个新的 `QSqlIndex`。
注意: 被移动的对象 other 处于部分构型状态,在此状态下,唯一有效的操作是销毁和赋新值。
此函数于 Qt 6.6 中引入。
[noexcept] QSqlIndex::~QSqlIndex()
销毁该对象并释放所有已分配的资源。
void QSqlIndex::append(const QSqlField &field)
将字段field 追加到索引字段列表中。该字段按升序添加到列表中。
void QSqlIndex::append(const QSqlField &field, bool desc)
将字段field 追加到索引字段列表中。该字段将按升序追加,除非desc 为真。
这是一个重载函数。
QString QSqlIndex::cursorName() const
返回 cursorName。
注意: 这是属性 cursorName 的获取 函数。
另请参阅 ` setCursorName()`。
bool QSqlIndex::isDescending(int i) const
如果索引中的字段i 按降序排序,则返回true ;否则返回false 。
QString QSqlIndex::name() const
返回名称。
注意: 用于获取属性 name 的获取器 函数。
另请参阅 setName()。
void QSqlIndex::setCursorName(const QString &cursorName)
将cursorName 设置为cursorName 。
注意: 这是属性cursorName 的设置 函数。
另请参阅 cursorName()。
void QSqlIndex::setDescending(int i, bool desc)
如果desc 为真,则字段i 将按降序排序。否则,字段i 将按升序排序(默认)。如果该字段不存在,则不执行任何操作。
另请参阅 isDescending()。
void QSqlIndex::setName(const QString &name)
将name 设置为name 。
注意: 这是属性name 的设置 函数。
另请参阅 name()。
[noexcept, since 6.6] QSqlIndex &QSqlIndex::operator=(QSqlIndex &&other)
将other 通过移动赋值操作赋给此QSqlIndex 实例。
注意: 被移动的对象 other 将处于一种部分初始化的状态,在此状态下,唯一有效的操作是销毁和赋值。
该函数在 Qt 6.6 中引入。
QSqlIndex &QSqlIndex::operator=(const QSqlIndex &other)
将索引设置为other 。
© 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.