QDomNodeList Class
QDomNodeList 类是QDomNode 对象的列表。更多
| Header: | #include <QDomNodeList> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Xml)target_link_libraries(mytarget PRIVATE Qt6::Xml) |
| qmake: | QT += xml |
- 所有成员(包括继承成员)的列表
- QDomNodeList 属于XML 类。
注意:该类中的所有函数都是可重入的。
公共函数
| QDomNodeList() | |
| QDomNodeList(const QDomNodeList &nodeList) | |
| ~QDomNodeList() | |
| QDomNode | at(int index) const |
| int | count() const |
| bool | isEmpty() const |
| QDomNode | item(int index) const |
| int | length() const |
| int | size() const |
| bool | operator!=(const QDomNodeList &other) const |
| QDomNodeList & | operator=(const QDomNodeList &other) |
| bool | operator==(const QDomNodeList &other) const |
详细说明
可通过QDomDocument::elementsByTagName() 和QDomNode::childNodes() 获取列表。文档对象模型(DOM)要求这些列表是 "活 "的:每当您更改底层文档时,列表的内容就会更新。
您可以使用item() 从列表中获取特定节点。列表中的条目数由length() 返回。
有关文档对象模型的更多信息,请参阅第 1 级和第 2 级核心。有关 DOM 实现的一般介绍,请参阅QDomDocument 文档。
另请参阅 QDomNode::childNodes() 和QDomDocument::elementsByTagName()。
成员函数文档
QDomNodeList::QDomNodeList()
创建一个空节点列表。
QDomNodeList::QDomNodeList(const QDomNodeList &nodeList)
构造nodeList 的副本。
[noexcept] QDomNodeList::~QDomNodeList()
销毁对象并释放其资源。
QDomNode QDomNodeList::at(int index) const
提供此函数是为了保持 Qt API 的一致性。它等同于item()。
如果index 为负数或index >=length() 则返回空节点(即QDomNode::isNull() 返回 true 的节点)。
int QDomNodeList::count() const
提供此函数是为了保持 Qt API 的一致性。它等同于length()。
bool QDomNodeList::isEmpty() const
如果列表不包含项目,则返回true ;否则返回false 。提供此函数是为了保持 Qt API 的一致性。
QDomNode QDomNodeList::item(int index) const
返回位置index 的节点。
如果index 为负数或index >=length() 则返回空节点(即QDomNode::isNull() 返回 true 的节点)。
另请参见 length()。
int QDomNodeList::length() const
返回列表中的节点数。
int QDomNodeList::size() const
提供此函数是为了保持 Qt API 的一致性。它等同于length()。
bool QDomNodeList::operator!=(const QDomNodeList &other) const
返回true 节点列表other 与此节点列表不相等;否则返回false 。
QDomNodeList &QDomNodeList::operator=(const QDomNodeList &other)
为该节点列表指定other 。
bool QDomNodeList::operator==(const QDomNodeList &other) const
如果节点列表other 和此节点列表相等,则返回true ;否则返回false 。
© 2025 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.