QMetaAssociation::Iterable::Iterator Class
class QMetaAssociation::Iterable::IteratorQMetaAssociation::Iterable::Iterator 允许在QVariant 中对容器进行迭代。更多内容...
该类在 Qt 6.11 中首次引入。
公共函数
| QVariant | key() const |
| QVariant | value() const |
| int | operator*() const |
| int | operator->() const |
详细描述
QMetaAssociation::Iterable::Iterator 只能由QMetaAssociation::Iterable 实例创建,其使用方式与其他 STL 风格的迭代器类似。
另请参阅 QMetaAssociation::Iterable 。
成员函数文档
QVariant Iterator::key() const
返回该迭代器所指向的键。
QVariant Iterator::value() const
返回该迭代器所指向的映射值。如果容器不提供映射值(例如集合),则返回一个无效的QVariant::Reference 。
int Iterator::operator*() const
返回当前项,并将其转换为QVariant::Reference 。生成的QVariant::Reference 若存在映射值,则解析为该值;若不存在,则解析为键值。
int Iterator::operator->() const
返回当前项,并将其转换为QVariant::Pointer 。生成的QVariant::Pointer 若存在映射值,则解析为该值;若不存在,则解析为键值。
© 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.