QWebElementCollection Class Reference

#include <mw/QtWebKit/qwebelement.h>

class QWebElementCollection

The QWebElementCollection class represents a collection of web elements. .

Detailed Description

Since
4.6 Elements in a document can be selected using QWebElement::findAll() or using the QWebElement constructor. The collection is composed by choosing all elements in the document that match a specified CSS selector expression.
The number of selected elements is provided through the count() property. Individual elements can be retrieved by index using at().

It is also possible to iterate through all elements in the collection using Qt's foreach macro:

        QWebElementCollection collection = document.findAll("p");
        foreach (QWebElement paraElement, collection) {
            ...
        }

Constructor & Destructor Documentation

QWebElementCollection ( )

QWebElementCollection()

Constructs an empty collection.

QWebElementCollection ( const QWebElement &, const QString & )

QWebElementCollection(const QWebElement &contextElement,
const QString &query
)

Constructs a collection of elements from the list of child elements of contextElement that match the specified CSS selector query.

QWebElementCollection ( const QWebElementCollection & )

QWebElementCollection(const QWebElementCollection &)

Constructs a copy of other.

~QWebElementCollection ( )

~QWebElementCollection()

Destroys the collection.

Member Function Documentation

append ( const QWebElementCollection & )

voidappend(const QWebElementCollection &collection)

Extends the collection by appending all items of other.

The resulting collection may include duplicate elements.

See also: operator+=()

at ( int )

QWebElement at(inti)const

Returns the element at index position i in the collection.

begin ( )

const_iterator begin()const [inline]

Returns an STL-style iterator pointing to the first element in the collection.

See also: end()

begin ( )

iterator begin()[inline]

Returns an STL-style iterator pointing to the first element in the collection.

See also: end()

constBegin ( )

const_iterator constBegin()const [inline]

Returns an STL-style iterator pointing to the first element in the collection.

See also: end()

constEnd ( )

const_iterator constEnd()const [inline]

Returns an STL-style iterator pointing to the imaginary element after the last element in the list.

See also: begin()

count ( )

intcount()const

Returns the number of elements in the collection.

end ( )

const_iterator end()const [inline]

Returns an STL-style iterator pointing to the imaginary element after the last element in the list.

See also: begin()

end ( )

iterator end()[inline]

Returns an STL-style iterator pointing to the imaginary element after the last element in the list.

See also: begin()

first ( )

QWebElement first()const [inline]

Returns the first element in the collection.

See also: last(), operator[](), at(), count()

last ( )

QWebElement last()const [inline]

Returns the last element in the collection.

See also: first(), operator[](), at(), count()

operator+ ( const QWebElementCollection & )

QWebElementCollection operator+(const QWebElementCollection &other)const

Returns a collection that contains all the elements of this collection followed by all the elements in the other collection. Duplicates may occur in the result.

See also: operator+=()

operator+= ( const QWebElementCollection & )

QWebElementCollection &operator+=(const QWebElementCollection &other)[inline]

Appends the items of the other list to this list and returns a reference to this list.

See also: operator+(), append()

operator= ( const QWebElementCollection & )

Assigns other to this collection and returns a reference to this collection.

operator[] ( int )

QWebElement operator[](inti)const [inline]

Returns the element at the specified position in the collection.

toList ( )

QList< QWebElement >toList()const

Returns a QList object with the elements contained in this collection.