- class QXmlStreamAttributes#
该
QXmlStreamAttributes类表示一个QXmlStreamAttribute向量。更多...摘要#
方法#
def
__init__()def
append()def
at()def
back()def
capacity()def
clear()定义
constData()定义
constFirst()定义
constLast()定义
count()定义
data()定义
empty()定义
first()定义
front()定义
insert()定义
isEmpty()定义
last()定义
length()定义
mid()定义
move()定义
__ne__()定义
__add__()定义
__lshift__()定义
__eq__()定义
operator[]()定义
prepend()定义
push_back()定义
push_front()定义
remove()定义
removeAll()定义
removeAt()定义
removeLast()定义
removeOne()定义
reserve()定义
resize()定义
size()定义
sliced()定义
squeeze()定义
swap()定义
takeAt()定义
toVector()定义
value()
静态函数#
定义
fromVector()
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对片段翻译的贡献。如果您发现翻译问题,也可以通过在https:/bugreports.qt.io/projects/PYSIDE创建工单的方式告诉我们。
详细描述#
属性由QXmlStreamReader类的attributes()方法返回,当读取器报告一个start element时。此类还可以与QXmlStreamWriter一起使用,作为writeAttributes()方法的参数。
便利函数value()遍历向量,并为给定的namespaceUri和属性名返回一个属性值。
可以使用append()方法添加新属性。
- __init__()
QXmlStreamAttributes的构造函数。- append(arg__1)
- 参数:
arg__1 –
QXmlStreamAttribute
- append(qualifiedName, value)
- 参数:
qualifiedName – str
value – str
这是一个重载函数。
以具有合格名称
qualifiedName和值value的新属性附加。- append(l)
- 参数:
l – .list of QXmlStreamAttribute
- append(namespaceUri, name, value)
- 参数:
namespaceUri – str
name – str
value – str
以具有合格名称
name并在namespaceUri描述的命名空间中,以及值value的新属性附加。命名空间URI可以是空的。- at(i)
- 参数:
i – int
- 返回类型:
- back()#
- 返回类型:
- capacity()#
- 返回类型:
int
- clear()#
- constData()#
- 返回类型:
- constFirst()#
- 返回类型:
- constLast()#
- 返回类型:
- count()#
- 返回类型:
int
- data()#
- 返回类型:
- empty()#
- 返回类型:
bool
- first(n)#
- 参数:
n - int
- 返回类型:
- first()
- 返回类型:
- 静态 fromVector(vector)#
- 参数:
vector - QXmlStreamAttribute的列表
- 返回类型:
- front()#
- 返回类型:
- hasAttribute(namespaceUri, name)#
- 参数:
namespaceUri – str
name – str
- 返回类型:
bool
这是一个重载函数。
如果此
QXmlStreamAttributes具有与namespaceUri和name相匹配的名称空间URI和名称的属性,则返回true;否则返回false。- hasAttribute(qualifiedName)
- 参数:
qualifiedName – str
- 返回类型:
bool
如果此
QXmlStreamAttributes具有与qualifiedName相同的限定名称的属性,则返回true;否则返回false。请注意,这并不是名称空间意识。例如,如果这个
QXmlStreamAttributes包含一个其词法名称为 “xlink:href” 的属性,这并不表示 XLink 命名空间中的名为href的属性存在,因为xlink前缀可以绑定到任何命名空间。请使用接受命名空间 URI 和局部名称作为参数的重载版本以提高代码的名称空间意识。- insert(arg__1, arg__2)#
- 参数:
arg__1 – int
arg__2 –
QXmlStreamAttribute
- isEmpty()#
- 返回类型:
bool
- 参数:
other – .list of QXmlStreamAttribute
- 返回类型:
bool
- last()#
- 返回类型:
- last(n)
- 参数:
n - int
- 返回类型:
- length()#
- 返回类型:
int
- mid(pos[, len=-1])#
- 参数:
pos – int
len – int
- 返回类型:
- move(from, to)#
- 参数:
from – int
to – int
- __ne__(arg__1)#
- 参数:
arg__1 –
QXmlStreamAttributes- 返回类型:
bool
- __add__(l)#
- 参数:
l – .list of QXmlStreamAttribute
- 返回类型:
- __lshift__(l)#
- 参数:
l – .list of QXmlStreamAttribute
- 返回类型:
- __eq__(arg__1)#
- 参数:
arg__1 –
QXmlStreamAttributes- 返回类型:
bool
- operator(i)#
- 参数:
i – int
- 返回类型:
- prepend(arg__1)#
- 参数:
arg__1 –
QXmlStreamAttribute
- push_back(arg__1)#
- 参数:
arg__1 –
QXmlStreamAttribute
- push_front(arg__1)#
- 参数:
arg__1 –
QXmlStreamAttribute
- remove(i[, n=1])#
- 参数:
i – int
n - int
- removeAll(arg__1)#
- 参数:
arg__1 –
QXmlStreamAttribute
- removeAt(i)#
- 参数:
i – int
- removeFirst()#
- removeLast()#
- removeOne(arg__1)#
- 参数:
arg__1 –
QXmlStreamAttribute
- reserve(size)#
- 参数:
size – int
- resize(size)#
- 参数:
size – int
- shrink_to_fit()#
- size()#
- 返回类型:
int
- sliced(pos)#
- 参数:
pos – int
- 返回类型:
- sliced(pos, n)
- 参数:
pos – int
n - int
- 返回类型:
- squeeze()#
- swap(other)#
- 参数:
other – .list of QXmlStreamAttribute
- swapItemsAt(i, j)#
- 参数:
i – int
j – int
- takeAt(i)#
- 参数:
i – int
- 返回类型:
- toVector()#
- 返回类型:
- value(namespaceUri, name)#
- 参数:
namespaceUri – str
name – str
- 返回类型:
str
返回在由
namespaceUri描述的命名空间中属性name的值,如果该属性未定义,则返回空字符串引用。namespaceUri可以是空的。注意
在 Qt 6.6 版本之前,此函数通过接受
QString和QLatin1StringView的组合的重载集来实现。- value(qualifiedName)
- 参数:
qualifiedName – str
- 返回类型:
str
这是一个重载函数。
返回名称为
qualifiedName的属性的值,如果该属性未定义,则返回空字符串引用。合格名称是 XML 数据中属性的原始名称。它由命名空间前缀后跟冒号,然后是属性的本地名称组成。由于命名空间前缀不是唯一的(相同的前缀可以指向不同的命名空间,同时不同的前缀可以指向相同的命名空间),因此您不应使用合格名称,而应使用已解析的命名空间 URI 和属性的本地名称。注意
在 Qt 6.6 版本之前,此函数通过仅接受
QString和QLatin1StringView的重载集来实现。