Home · All Classes · Modules

QWebElementCollection Class Reference
[QtWebKit module]

The QWebElementCollection class represents a collection of web elements. More...


Special Methods

Detailed Description

The QWebElementCollection class represents a collection of web elements.

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) {

Method Documentation

QWebElementCollection.__init__ (self)

Constructs an empty collection.

QWebElementCollection.__init__ (self, QWebElement contextElement, QString query)

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

QWebElementCollection.__init__ (self, QWebElementCollection)

Constructs a copy of other.

QWebElementCollection.append (self, QWebElementCollection collection)

Extends the collection by appending all items of other.

The resulting collection may include duplicate elements.

See also operator+=().

QWebElement QWebElementCollection.at (self, int i)

Returns the element at index position i in the collection.

int QWebElementCollection.count (self)

Returns the number of elements in the collection.

QWebElement QWebElementCollection.first (self)

Returns the first element in the collection.

See also last(), operator[](), at(), and count().

QWebElement QWebElementCollection.last (self)

Returns the last element in the collection.

See also first(), operator[](), at(), and count().

unknown-type QWebElementCollection.toList (self)

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

QWebElementCollection QWebElementCollection.__add__ (self, QWebElementCollection other)

QWebElement QWebElementCollection.__getitem__ (self, int i)

QWebElementCollection QWebElementCollection.__iadd__ (self, QWebElementCollection other)

int QWebElementCollection.__len__ (self)

PyQt 4.12.1 for X11Copyright © Riverbank Computing Ltd and The Qt Company 2015Qt 4.8.7