6.0.0-rc4Source

QXmlStreamAttributes Class

The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute. More…

Header#include <QXmlStreamAttributes>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes
InheritsQList

List of all members, including inherited members

Public Functions

QXmlStreamAttributes()
QStringViewvalue(const QString &namespaceUri, const QString &name) const
QStringViewvalue(const QString &qualifiedName) const
voidappend(const QString &namespaceUri, const QString &name, const QString &value)
voidappend(const QString &qualifiedName, const QString &value)
boolhasAttribute(const QString &qualifiedName) const
boolhasAttribute(const QString &namespaceUri, const QString &name) const

Detailed Description

The class is a QList of attributes with functions that find the value of one by its name.

const QXmlStreamAttributes attributes = xml.attributes();
if (attributes.hasAttribute("width"))
    width = attributes.value("width").toInt();

See also QXmlStreamReader::attributes().

Differences from Qt

The names are const QString &; there are no QAnyStringView overloads.

Member Function Documentation

QXmlStreamAttributes::QXmlStreamAttributes()

Constructs an empty list of attributes.

void QXmlStreamAttributes::append(const QString &namespaceUri, const QString &name, const QString &value)

Appends an attribute with the local name name in the namespace namespaceUri and the value value.

void QXmlStreamAttributes::append(const QString &qualifiedName, const QString &value)

This is an overloaded function.

Appends an attribute with the qualified name qualifiedName and the value value.

bool QXmlStreamAttributes::hasAttribute(const QString &qualifiedName) const

Returns true if the list has an attribute with the qualified name qualifiedName.

bool QXmlStreamAttributes::hasAttribute(const QString &namespaceUri, const QString &name) const

This is an overloaded function.

Returns true if the list has an attribute with the local name name in the namespace namespaceUri.

QStringView QXmlStreamAttributes::value(const QString &namespaceUri, const QString &name) const

Returns the value of the attribute with the local name name in the namespace namespaceUri, or a null view if there is none.

QStringView QXmlStreamAttributes::value(const QString &qualifiedName) const

This is an overloaded function.

Returns the value of the attribute with the qualified name qualifiedName, or a null view if there is none.