QIterable Class
template <typename Container> class QIterableQIterable 是一个模板类,是QMetaSequence::Iterable 和QMetaAssociation::Iterable 的基类。更多
| 头文件: | #include <QIterable> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core)target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
| 自 | Qt 6.0 |
| 继承于 |
公共函数
| bool | canForwardIterate() const |
| bool | canInputIterate() const |
| bool | canRandomAccessIterate() const |
| bool | canReverseIterate() const |
| void | clear() |
| QConstIterator<Container> | constBegin() const |
| QConstIterator<Container> | constEnd() const |
| QIterator<Container> | mutableBegin() |
| QIterator<Container> | mutableEnd() |
| qsizetype | size() const |
成员函数文档
bool QIterable::canForwardIterate() const
返回是否可以向前遍历容器。这与容器的 iterator 和 const_iterator 的 std::forward_iterator_tag iterator 特性相对应。
bool QIterable::canInputIterate() const
返回容器是否有输入迭代器。这与容器的 iterator 和 const_iterator 的 std::input_iterator_tag iterator 特性相对应。
bool QIterable::canRandomAccessIterate() const
返回是否可以使用迭代器有效地跳过多个值。这对应于容器的 iterator 和 const_iterator 的 std::random_access_iterator_tag iterator 特性。
bool QIterable::canReverseIterate() const
返回是否可以反向遍历容器。这与容器的 const_iterator 的 std::bidirectional_iterator_tag iterator 特性相对应。
void QIterable::clear()
清除容器。
QConstIterator<Container> QIterable::constBegin() const
返回容器起始位置的QConstIterator 。这可用于 stl 风格的迭代。
另请参阅 constEnd() 和mutableBegin()。
QConstIterator<Container> QIterable::constEnd() const
返回容器末端的 Qterable::QConstIterator。这可用于 stl 风格的迭代。
另请参阅 constBegin() 和mutableEnd() 。
QIterator<Container> QIterable::mutableBegin()
返回容器起始位置的QIterator 。这可用于 stl 风格的迭代。
另请参阅 mutableEnd() 和constBegin()。
QIterator<Container> QIterable::mutableEnd()
返回容器末尾的 QMetaSequence::Iterable::iterator。这可用于 stl 风格的迭代。
另请参阅 mutableBegin() 和constEnd() 。
qsizetype QIterable::size() const
返回容器中值的个数。
注意: 如果底层容器不提供查询大小的本机方法,此方法将使用迭代器合成访问。此行为已被弃用,并将在未来的 Qt 版本中删除。
© 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.