QWebEngineScriptCollection 类

QWebEngineScriptCollection class represents a collection of user scripts. 更多...

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


~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


QWebEngineScriptCollection class represents a collection of user scripts.

QWebEngineScriptCollection manages a set of user scripts.

使用 QWebEnginePage::scripts () 和 QWebEngineProfile::scripts () 去访问与单个页面或共享同一配置文件的多个页面关联的脚本集合。

另请参阅 脚本注入 .


QWebEngineScriptCollection:: ~QWebEngineScriptCollection ()


void QWebEngineScriptCollection:: clear ()


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

返回 true if the collection contains an occurrence of value ;否则返回 false .

int QWebEngineScriptCollection:: count () const


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.

注意: 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.

另请参阅 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 )

插入脚本 s 进集合。

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

Inserts scripts from the list list 进集合。

bool QWebEngineScriptCollection:: isEmpty () const

返回 true 若集合为空;否则返回 false .

bool QWebEngineScriptCollection:: remove (const QWebEngineScript & script )

移除 script 从集合。

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

int QWebEngineScriptCollection:: size () const


QList < QWebEngineScript > QWebEngineScriptCollection:: toList () const

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