QWebElementCollection Class Reference

[ QtWebKit module]

The QWebElementCollection class represents a collection of web 元素。 更多...

方法

Special Methods


详细描述

The QWebElementCollection class represents a collection of web 元素。

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

方法文档编制

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 )

构造副本为 other .

QWebElementCollection.append ( self , QWebElementCollection   collection )

Extends the collection by appending all items of other .

The resulting collection may include duplicate elements.

另请参阅 operator+= ().

QWebElement QWebElementCollection.at ( self , int  i )

Returns the element at index position i 在 collection.

int QWebElementCollection.count ( self )

返回集合中的元素数。

QWebElement QWebElementCollection.first ( self )

Returns the first element in the collection.

另请参阅 last (), operator[] (), at (),和 count ().

QWebElement QWebElementCollection.last ( self )

Returns the last element in the collection.

另请参阅 first (), operator[] (), at (),和 count ().

list-of-QWebElement QWebElementCollection.toList ( self )

返回 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 )

QWebElementCollection.__len__ ( self )