6.0.0-rc4Source

QJSValueIterator Class

The QJSValueIterator class iterates over the enumerable own properties of an object. More…

Header#include <QJSValueIterator>
CMaketarget_link_libraries(app PRIVATE Nt::Qml)
ModuleNt Qml C++ Classes

List of all members, including inherited members

Public Functions

QJSValueIterator(const QJSValue &object)
~QJSValueIterator()
boolhasNext() const
boolnext()
QStringname() const
QJSValuevalue() const
QJSValueIterator &operator=(QJSValue &object)

Detailed Description

QJSValueIterator it(object);
while (it.hasNext()) {
    it.next();
    qDebug() << it.name() << it.value().toString();
}

The names are read when the iterator is made; properties added later are not seen.

See also QJSValue::property().

Differences from Qt

None.

Member Function Documentation

[explicit] QJSValueIterator::QJSValueIterator(const QJSValue &object)

Constructs an iterator over the properties of object, before the first one.

QJSValueIterator::~QJSValueIterator()

Destroys the iterator.

bool QJSValueIterator::hasNext() const

Returns true if there is a property after the current one; otherwise returns false.

QString QJSValueIterator::name() const

Returns the name of the current property.

bool QJSValueIterator::next()

Moves to the next property. Returns true if there was one.

QJSValueIterator & QJSValueIterator::operator=(QJSValue &object)

Starts iterating over object, and returns a reference to the iterator.

QJSValue QJSValueIterator::value() const

Returns the value of the current property.