QWebElementCollection Class

The QWebElementCollection class represents a collection of web elements. 更多...

頭: #include <QWebElementCollection>
Since: Qt 4.6

該類在開發且可能改變。

公共類型

class const_iterator
class iterator

公共函數

QWebElementCollection ()
QWebElementCollection (const QWebElement & contextElement , const QString & query )
QWebElementCollection (const QWebElementCollection & other )
~QWebElementCollection ()
void append (const QWebElementCollection & other )
QWebElement at (int i ) const
const_iterator begin () const
iterator begin ()
const_iterator constBegin () const
const_iterator constEnd () const
int count () const
const_iterator end () const
iterator end ()
QWebElement first () const
QWebElement last () const
QList<QWebElement> toList () const
QWebElementCollection operator+ (const QWebElementCollection & other ) const
QWebElementCollection & operator+= (const QWebElementCollection & other )
QWebElementCollection & operator= (const QWebElementCollection & other )
QWebElement operator[] (int position ) const

詳細描述

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

成員函數文檔編製

QWebElementCollection:: QWebElementCollection ()

Constructs an empty collection.

QWebElementCollection:: 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:: QWebElementCollection (const QWebElementCollection & other )

構造副本為 other .

QWebElementCollection:: ~QWebElementCollection ()

銷毀集閤。

void QWebElementCollection:: append (const QWebElementCollection & other )

Extends the collection by appending all items of other .

The resulting collection may include duplicate elements.

另請參閱 operator+= ().

QWebElement QWebElementCollection:: at ( int i ) const

Returns the element at index position i in the collection.

const_iterator QWebElementCollection:: begin () const

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

另請參閱 end ().

iterator QWebElementCollection:: begin ()

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

另請參閱 end ().

const_iterator QWebElementCollection:: constBegin () const

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

另請參閱 end ().

const_iterator QWebElementCollection:: constEnd () const

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

另請參閱 begin ().

int QWebElementCollection:: count () const

返迴集閤中的元素數。

const_iterator QWebElementCollection:: end () const

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

另請參閱 begin ().

iterator QWebElementCollection:: end ()

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

另請參閱 begin ().

QWebElement QWebElementCollection:: first () const

Returns the first element in the collection.

另請參閱 last (), operator[] (), at (),和 count ().

QWebElement QWebElementCollection:: last () const

Returns the last element in the collection.

另請參閱 first (), operator[] (), at (),和 count ().

QList < QWebElement > QWebElementCollection:: toList () const

返迴 QList object with the elements contained in this collection.

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.

另請參閱 operator+= ().

QWebElementCollection & QWebElementCollection:: operator+= (const QWebElementCollection & other )

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

另請參閱 operator+ () 和 append ().

QWebElementCollection & QWebElementCollection:: operator= (const QWebElementCollection & other )

賦值 other to this collection and returns a reference to this collection.

QWebElement QWebElementCollection:: operator[] ( int position ) const

Returns the element at the specified position in the collection.