QWebEngineScriptCollection Class | Qt WebEngine 5.10

Qt 5.10 | Qt WebEngine | C++ Classes | QWebEngineScriptCollection

Qt 5.10.1 Reference Documentation

# QWebEngineScriptCollection Class

The QWebEngineScriptCollection class represents a collection of user scripts. More...

Header: | #include <QWebEngineScriptCollection>
qmake: | QT += webenginewidgets
Since: | Qt 5.5

- List of all members, including inherited members

## Public Functions

| ~QWebEngineScriptCollection()
void | clear()
bool | contains(const QWebEngineScript &value) const
int | count() const
QWebEngineScript | findScript(const QString &name) const
QList<QWebEngineScript> | findScripts(const QString &name) const
void | insert(const QWebEngineScript &s)
void | insert(const QList<QWebEngineScript> &list)
bool | isEmpty() const
bool | remove(const QWebEngineScript &script)
int | size() const
QList<QWebEngineScript> | toList() const

## Detailed Description

The QWebEngineScriptCollection class represents a collection of user scripts.

QWebEngineScriptCollection manages a set of user scripts.

Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access the collection of scripts associated with a single page or a number of pages sharing the same profile.

## Member Function Documentation

### QWebEngineScriptCollection::~QWebEngineScriptCollection()

Destroys the collection.

### void QWebEngineScriptCollection::clear()

Removes all scripts from this collection.

### bool QWebEngineScriptCollection::contains(const QWebEngineScript &value) const

Returns `true` if the collection contains an occurrence of value; otherwise returns `false`.

### int QWebEngineScriptCollection::count() const

Returns the number of elements in the collection.

### QWebEngineScript QWebEngineScriptCollection::findScript(const QString &name) const

Returns the first script found in the collection with the name name, or a null QWebEngineScript if none was found.

Note: The order in which the script collection is traversed is undefined, which means this should be used when the unicity is guaranteed at the application level.

See also findScripts().

### QList<QWebEngineScript> QWebEngineScriptCollection::findScripts(const QString &name) const

Returns the list of scripts in the collection with the name name, or an empty list if none was found.

### void QWebEngineScriptCollection::insert(const QWebEngineScript &s)

Inserts the script s into the collection.

### void QWebEngineScriptCollection::insert(const QList<QWebEngineScript> &list)

Inserts scripts from the list list into the collection.

### bool QWebEngineScriptCollection::isEmpty() const

Returns `true` if the collection is empty; otherwise returns `false`.

### bool QWebEngineScriptCollection::remove(const QWebEngineScript &script)

Removes script from the collection.

Returns `true` if the script was found and successfully removed from the collection; otherwise returns `false`.

### int QWebEngineScriptCollection::size() const

Returns the number of elements in the collection.

### QList<QWebEngineScript> QWebEngineScriptCollection::toList() const

Returns a list with the values of the scripts used in this collection.