CopperSpice API  1.9.2
QWebElementCollection Class Reference

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

Classes

class  const_iterator
 Provides an STL-style const iterator for QWebElementCollection More...
 
class  iterator
 The QWebElementCollection::iterator class provides an STL-style iterator for QWebElementCollection More...
 

Public Methods

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

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 the C++ range based for() syntax.

QWebElementCollection collection = document.findAll("p");
for (QWebElement paraElement : collection) {
// ...
}
See also
operator+=()

Constructor & Destructor Documentation

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)

Constructs a copy of other.

QWebElementCollection::~QWebElementCollection ( )

Destroys the collection.

Method Documentation

void QWebElementCollection::append ( const QWebElementCollection &  other)

Extends the collection by appending all items of other. The resulting collection may include duplicate elements.

See also
operator+=()
QWebElement QWebElementCollection::at ( int  i) const

Returns the element at index position i in the collection.

iterator QWebElementCollection::begin ( )
inline

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

See also
end()
const_iterator QWebElementCollection::begin ( ) const
inline

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

See also
end()
const_iterator QWebElementCollection::constBegin ( ) const
inline

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

See also
end()
const_iterator QWebElementCollection::constEnd ( ) const
inline

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

See also
begin()
int QWebElementCollection::count ( ) const

Returns the number of elements in the collection.

iterator QWebElementCollection::end ( )
inline

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

See also
begin()
const_iterator QWebElementCollection::end ( ) const
inline

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

See also
begin()
QWebElement QWebElementCollection::first ( ) const
inline

Returns the first element in the collection.

See also
last(), operator[](), at(), count()
QWebElement QWebElementCollection::last ( ) const
inline

Returns the last element in the collection.

See also
first(), operator[](), at(), count()
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+=()
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()
QWebElementCollection & QWebElementCollection::operator= ( const QWebElementCollection &  other)

Copy assigns from other and returns a reference to this object.

QWebElement QWebElementCollection::operator[] ( int  i) const
inline

Returns the element at the specified i in the collection.

QList< QWebElement > QWebElementCollection::toList ( ) const

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