QXmlStreamAttributes Class
The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute. More…
| Header | #include <QXmlStreamAttributes> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Core) |
| Module | Nt Core C++ Classes |
| Inherits | QList |
List of all members, including inherited members
Public Functions
| QXmlStreamAttributes() | |
| QStringView | value(const QString &namespaceUri, const QString &name) const |
| QStringView | value(const QString &qualifiedName) const |
| void | append(const QString &namespaceUri, const QString &name, const QString &value) |
| void | append(const QString &qualifiedName, const QString &value) |
| bool | hasAttribute(const QString &qualifiedName) const |
| bool | hasAttribute(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.