iblqt.widgets.RestrictedWebView

class iblqt.widgets.RestrictedWebView[source]

Bases: QWidget

A browser widget that restricts navigation to a trusted URL prefix.

__init__(url, trusted_url_prefix=None, use_tool_tips=True, use_status_tips=False, parent=None)[source]

Initialize the RestrictedWebView.

Parameters:
  • url (QUrl or str) – The initial URL to load in the browser.

  • trusted_url_prefix (str, optional) – Prefix of trusted URLs. Clicking on links to matching URLs will open in the widget’s web engine view, while other links will open in the default web browser. Defaults to the value of url.

  • use_tool_tips (bool, optional) – Whether to set default tool tips for the buttons. Default is True.

  • use_status_tips (bool, optional) – Whether to set default status tips for the buttons. Default is False.

  • parent (QWidget or None, optional) – The parent widget.

setTrustedUrlPrefix(trusted_url_prefix)[source]

Set the trusted URL prefix.

Parameters:

trusted_url_prefix (str) – The prefix of trusted URLs. Clicking on links to matching URLs will open in the widget’s web engine view, while other links will open in the default web browser.

setUrl(url)[source]

Set the URL to be displayed in the web engine view.

Parameters:

url (QUrl or str) – The URL to load in the web engine view.

Returns:

True if the navigation request is accepted, False otherwise.

Return type:

bool

trustedUrlPrefix()[source]

Get the trusted URL prefix.

Returns:

The prefix of trusted URLs. Clicking on links to matching URLs will open in the widget’s web engine view, while other links will open in the default web browser.

Return type:

str

url()[source]

Get the current URL displayed in the web engine view.

Returns:

The current URL.

Return type:

QUrl