- Qt 6.5
- Qt WebEngine
- C++ Classes
- QtWebEngineCore
- QWebEngineScriptCollection
- Qt 6.5.2 Reference Documentation

# QWebEngineScriptCollection Class

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

Header: | #include <QWebEngineScriptCollection>
CMake: | find_package(Qt6 REQUIRED COMPONENTS WebEngineCore) target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: | QT += webenginecore

- List of all members, including inherited members

## Public Functions

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

## Detailed Description

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.

See also Script Injection.

## 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.

### QList<QWebEngineScript> QWebEngineScriptCollection::find(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`.

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

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