Skip to content

webenginecore

Class info

Classes

Name Children Inherits
WebEngineContextMenuRequest
prettyqt.webenginecore.webenginecontextmenurequest
    WebEngineDownloadRequest
    prettyqt.webenginecore.webenginedownloadrequest
      WebEngineHistory
      prettyqt.webenginecore.webenginehistory
        WebEngineHistoryItem
        prettyqt.webenginecore.webenginehistoryitem
          WebEngineHttpRequest
          prettyqt.webenginecore.webenginehttprequest
            WebEnginePage
            prettyqt.webenginecore.webenginepage
            A web engine page holds the HTML document contents, link history + actions.
              WebEnginePermission
              prettyqt.webenginecore.webenginepermission
              Represents a permission request or stored permission for a web origin.
                WebEngineProfile
                prettyqt.webenginecore.webengineprofile
                  WebEngineScript
                  prettyqt.webenginecore.webenginescript
                    WebEngineScriptCollection
                    prettyqt.webenginecore.webenginescriptcollection
                      WebEngineSettings
                      prettyqt.webenginecore.webenginesettings
                        WebEngineUrlScheme
                        prettyqt.webenginecore.webengineurlscheme
                          WebEngineUrlSchemeHandler
                          prettyqt.webenginecore.webengineurlschemehandler
                          • CallbackWebEngineUrlSchemeHandler

                          🛈 DocStrings

                          Classes and functions for embedding web content in applications.

                          WebEngineContextMenuRequest

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          class WebEngineContextMenuRequest:
                              def __init__(self, item: QtWebEngineCore.QWebEngineContextMenuRequest):
                                  self.item = item
                          
                              def __getattr__(self, val):
                                  return getattr(self.item, val)
                          
                              def get_media_url(self) -> core.Url:
                                  return core.Url(self.item.mediaUrl())
                          
                              def get_link_url(self) -> core.Url:
                                  return core.Url(self.item.linkUrl())
                          
                              def get_media_type(self) -> MediaTypeStr:
                                  """Get media type."""
                                  return MEDIA_TYPES.inverse[self.item.mediaType()]
                          
                              def get_media_flags(self) -> list[MediaFlagStr]:
                                  """Get media flags."""
                                  return MEDIA_FLAGS.get_list(self.item.mediaFlags())
                          
                              def get_edit_flags(self) -> list[EditFlagStr]:
                                  """Get edit flags."""
                                  return EDIT_FLAGS.get_list(self.item.editFlags())
                          
                              def can_undo(self) -> bool:
                                  """Returns whether undo is possible."""
                                  return bool(mod.EditFlag.CanUndo & self.item.editFlags())
                          
                              def can_redo(self) -> bool:
                                  """Returns whether redo is possible."""
                                  return bool(mod.EditFlag.CanRedo & self.item.editFlags())
                          
                              def can_cut(self) -> bool:
                                  """Returns whether cut is possible."""
                                  return bool(mod.EditFlag.CanCut & self.item.editFlags())
                          
                              def can_copy(self) -> bool:
                                  """Returns whether copy is possible."""
                                  return bool(mod.EditFlag.CanCopy & self.item.editFlags())
                          
                              def can_paste(self) -> bool:
                                  """Returns whether paste is possible."""
                                  return bool(mod.EditFlag.CanPaste & self.item.editFlags())
                          
                              def can_delete(self) -> bool:
                                  """Returns whether delete is possible."""
                                  return bool(mod.EditFlag.CanDelete & self.item.editFlags())
                          
                              def can_select_all(self) -> bool:
                                  """Returns whether select_all is possible."""
                                  return bool(mod.EditFlag.CanSelectAll & self.item.editFlags())
                          
                              def can_translate(self) -> bool:
                                  """Returns whether translate is possible."""
                                  return bool(mod.EditFlag.CanTranslate & self.item.editFlags())
                          
                              def can_edit_richly(self) -> bool:
                                  """Returns whether edit_richly is possible."""
                                  return bool(mod.EditFlag.CanEditRichly & self.item.editFlags())
                          

                          can_copy() -> bool

                          Returns whether copy is possible.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def can_copy(self) -> bool:
                              """Returns whether copy is possible."""
                              return bool(mod.EditFlag.CanCopy & self.item.editFlags())
                          

                          can_cut() -> bool

                          Returns whether cut is possible.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def can_cut(self) -> bool:
                              """Returns whether cut is possible."""
                              return bool(mod.EditFlag.CanCut & self.item.editFlags())
                          

                          can_delete() -> bool

                          Returns whether delete is possible.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def can_delete(self) -> bool:
                              """Returns whether delete is possible."""
                              return bool(mod.EditFlag.CanDelete & self.item.editFlags())
                          

                          can_edit_richly() -> bool

                          Returns whether edit_richly is possible.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def can_edit_richly(self) -> bool:
                              """Returns whether edit_richly is possible."""
                              return bool(mod.EditFlag.CanEditRichly & self.item.editFlags())
                          

                          can_paste() -> bool

                          Returns whether paste is possible.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def can_paste(self) -> bool:
                              """Returns whether paste is possible."""
                              return bool(mod.EditFlag.CanPaste & self.item.editFlags())
                          

                          can_redo() -> bool

                          Returns whether redo is possible.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def can_redo(self) -> bool:
                              """Returns whether redo is possible."""
                              return bool(mod.EditFlag.CanRedo & self.item.editFlags())
                          

                          can_select_all() -> bool

                          Returns whether select_all is possible.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def can_select_all(self) -> bool:
                              """Returns whether select_all is possible."""
                              return bool(mod.EditFlag.CanSelectAll & self.item.editFlags())
                          

                          can_translate() -> bool

                          Returns whether translate is possible.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def can_translate(self) -> bool:
                              """Returns whether translate is possible."""
                              return bool(mod.EditFlag.CanTranslate & self.item.editFlags())
                          

                          can_undo() -> bool

                          Returns whether undo is possible.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def can_undo(self) -> bool:
                              """Returns whether undo is possible."""
                              return bool(mod.EditFlag.CanUndo & self.item.editFlags())
                          

                          get_edit_flags() -> list[EditFlagStr]

                          Get edit flags.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def get_edit_flags(self) -> list[EditFlagStr]:
                              """Get edit flags."""
                              return EDIT_FLAGS.get_list(self.item.editFlags())
                          

                          get_media_flags() -> list[MediaFlagStr]

                          Get media flags.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def get_media_flags(self) -> list[MediaFlagStr]:
                              """Get media flags."""
                              return MEDIA_FLAGS.get_list(self.item.mediaFlags())
                          

                          get_media_type() -> MediaTypeStr

                          Get media type.

                          Source code in prettyqt/webenginecore/webenginecontextmenurequest.py
                          def get_media_type(self) -> MediaTypeStr:
                              """Get media type."""
                              return MEDIA_TYPES.inverse[self.item.mediaType()]
                          

                          WebEngineDownloadRequest

                          Source code in prettyqt/webenginecore/webenginedownloadrequest.py
                          class WebEngineDownloadRequest:
                              def __init__(self, item: QtWebEngineCore.QWebEngineDownloadRequest):
                                  self.item = item
                          
                              def __getattr__(self, val):
                                  return getattr(self.item, val)
                          
                              def get_interrupt_reason(self) -> DownloadInterruptReasonStr:
                                  """Get reason for download interruption."""
                                  return DOWNLOAD_INTERRUPT_REASONS.inverse[self.item.interruptReason()]
                          
                              def get_state(self) -> DownloadStateStr:
                                  """Get current state."""
                                  return DOWNLOAD_STATE.inverse[self.item.state()]
                          
                              def set_save_page_format(self, fmt: SavePageFormatStr | Item.SavePageFormat):
                                  """Set the save page format.
                          
                                  Args:
                                      fmt: save page format for the layout
                                  """
                                  self.item.setSavePageFormat(SAVE_PAGE_FORMAT.get_enum_value(fmt))
                          
                              def get_save_page_format(self) -> SavePageFormatStr:
                                  """Return current save page format.
                          
                                  Returns:
                                      Save page format
                                  """
                                  return SAVE_PAGE_FORMAT.inverse[self.item.savePageFormat()]
                          

                          get_interrupt_reason() -> DownloadInterruptReasonStr

                          Get reason for download interruption.

                          Source code in prettyqt/webenginecore/webenginedownloadrequest.py
                          def get_interrupt_reason(self) -> DownloadInterruptReasonStr:
                              """Get reason for download interruption."""
                              return DOWNLOAD_INTERRUPT_REASONS.inverse[self.item.interruptReason()]
                          

                          get_save_page_format() -> SavePageFormatStr

                          Return current save page format.

                          Source code in prettyqt/webenginecore/webenginedownloadrequest.py
                          def get_save_page_format(self) -> SavePageFormatStr:
                              """Return current save page format.
                          
                              Returns:
                                  Save page format
                              """
                              return SAVE_PAGE_FORMAT.inverse[self.item.savePageFormat()]
                          

                          get_state() -> DownloadStateStr

                          Get current state.

                          Source code in prettyqt/webenginecore/webenginedownloadrequest.py
                          def get_state(self) -> DownloadStateStr:
                              """Get current state."""
                              return DOWNLOAD_STATE.inverse[self.item.state()]
                          

                          set_save_page_format(fmt: SavePageFormatStr | Item.SavePageFormat)

                          Set the save page format.

                          Parameters:

                          Name Type Description Default
                          fmt SavePageFormatStr | SavePageFormat

                          save page format for the layout

                          required
                          Source code in prettyqt/webenginecore/webenginedownloadrequest.py
                          def set_save_page_format(self, fmt: SavePageFormatStr | Item.SavePageFormat):
                              """Set the save page format.
                          
                              Args:
                                  fmt: save page format for the layout
                              """
                              self.item.setSavePageFormat(SAVE_PAGE_FORMAT.get_enum_value(fmt))
                          

                          WebEngineHistory

                          Source code in prettyqt/webenginecore/webenginehistory.py
                          class WebEngineHistory:
                              def __init__(self, history: webenginecore.QWebEngineHistory):
                                  self.history = history
                          
                              def __getattr__(self, val):
                                  return getattr(self.history, val)
                          
                              def __len__(self):
                                  # pyside2 does not support len(self.history)
                                  return self.history.count()
                          
                              def __getitem__(self, index: int) -> webenginecore.WebEngineHistoryItem:
                                  item = self.history.itemAt(index)
                                  return webenginecore.WebEngineHistoryItem(item)
                          
                              def __iter__(self) -> Iterator[webenginecore.WebEngineHistoryItem]:
                                  items = [webenginecore.WebEngineHistoryItem(i) for i in self.history.items()]
                                  return iter(items)
                          
                              def get_items(self) -> list[webenginecore.WebEngineHistoryItem]:
                                  """Get history items."""
                                  return [webenginecore.WebEngineHistoryItem(i) for i in self.history.items()]
                          

                          get_items() -> list[webenginecore.WebEngineHistoryItem]

                          Get history items.

                          Source code in prettyqt/webenginecore/webenginehistory.py
                          def get_items(self) -> list[webenginecore.WebEngineHistoryItem]:
                              """Get history items."""
                              return [webenginecore.WebEngineHistoryItem(i) for i in self.history.items()]
                          

                          WebEngineHttpRequest

                          Bases: QWebEngineHttpRequest

                          Source code in prettyqt/webenginecore/webenginehttprequest.py
                          class WebEngineHttpRequest(QtWebEngineCore.QWebEngineHttpRequest):
                              def __repr__(self):
                                  return f"{type(self).__name__}({self.get_url()})"
                          
                              def set_headers(self, headers: dict[str, str]):
                                  for k, v in headers.items():
                                      self.setHeader(core.QByteArray(k.encode()), core.QByteArray(v.encode()))
                          
                              def get_headers(self) -> dict[str, str]:
                                  return {
                                      bytes(h.data()).decode(): bytes(self.header(h).data()).decode()
                                      for h in self.headers()
                                  }
                          
                              def set_url(self, url: datatypes.UrlType):
                                  self.setUrl(datatypes.to_url(url))
                          
                              def get_url(self) -> core.Url:
                                  return core.Url(self.url())
                          
                              def get_post_data(self) -> str:
                                  return bytes(self.postData().data()).decode()
                          
                              def set_method(
                                  self, method: MethodStr | QtWebEngineCore.QWebEngineHttpRequest.Method
                              ):
                                  """Set method this WebEngine request is using.
                          
                                  Args:
                                      method: method
                                  """
                                  self.setMethod(METHODS.get_enum_value(method))
                          
                              def get_method(self) -> MethodStr:
                                  """Get the method this WebEngine request is using.
                          
                                  Returns:
                                      method
                                  """
                                  return METHODS.inverse[self.method()]
                          

                          get_method() -> MethodStr

                          Get the method this WebEngine request is using.

                          Source code in prettyqt/webenginecore/webenginehttprequest.py
                          def get_method(self) -> MethodStr:
                              """Get the method this WebEngine request is using.
                          
                              Returns:
                                  method
                              """
                              return METHODS.inverse[self.method()]
                          

                          set_method(method: MethodStr | QtWebEngineCore.QWebEngineHttpRequest.Method)

                          Set method this WebEngine request is using.

                          Parameters:

                          Name Type Description Default
                          method MethodStr | Method

                          method

                          required
                          Source code in prettyqt/webenginecore/webenginehttprequest.py
                          def set_method(
                              self, method: MethodStr | QtWebEngineCore.QWebEngineHttpRequest.Method
                          ):
                              """Set method this WebEngine request is using.
                          
                              Args:
                                  method: method
                              """
                              self.setMethod(METHODS.get_enum_value(method))
                          

                          WebEnginePage

                          Bases: ObjectMixin, QWebEnginePage

                          A web engine page holds the HTML document contents, link history + actions.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          class WebEnginePage(core.ObjectMixin, webenginecore.QWebEnginePage):
                              """A web engine page holds the HTML document contents, link history + actions."""
                          
                              def get_icon(self) -> gui.Icon | None:
                                  """Return icon. If icon is Null, return None."""
                                  icon = self.icon()
                                  return None if icon.isNull() else gui.Icon(icon)
                          
                              def set_url(self, url: datatypes.PathType | datatypes.UrlType):
                                  """Set the url of the WebEnginePage.
                          
                                  Clears the Page and loads the URL.
                          
                                  Args:
                                      url: URL to set
                                  """
                                  self.setUrl(datatypes.to_url(url))
                          
                              def get_url(self) -> core.Url:
                                  return core.Url(self.url())
                          
                              def get_icon_url(self) -> core.Url:
                                  return core.Url(self.iconUrl())
                          
                              def get_requested_url(self) -> core.Url:
                                  return core.Url(self.requestedUrl())
                          
                              def get_scroll_position(self) -> core.PointF:
                                  return core.PointF(self.scrollPosition())
                          
                              def get_contents_size(self) -> core.SizeF:
                                  return core.SizeF(self.contentsSize())
                          
                              def load_url(self, url: datatypes.UrlType | datatypes.PathType):
                                  """Load the URL.
                          
                                  Loads the specified url and displays it.
                          
                                  Note: The Page remains the same until enough data has arrived
                                  to display the new URL.
                          
                                  Args:
                                      url: URL to load
                                  """
                                  self.load(datatypes.to_url(url))
                          
                              def set_zoom(self, zoom: float):
                                  """Set the zoom factor for the Page.
                          
                                  Valid values are within the range from 0.25 to 5.0. The default factor is 1.0.
                          
                                  Args:
                                      zoom: Zoom factor
                                  """
                                  self.setZoomFactor(zoom)
                          
                              def find_text(
                                  self,
                                  string: str,
                                  backward: bool = False,
                                  case_sensitive: bool = False,
                                  callback: Callable[[bool], None] | None = None,
                              ):
                                  """Find text in the current page.
                          
                                  Finds the specified string, subString, in the page, using the given options.
                                  The findTextFinished() signal is emitted when a string search is completed.
                          
                                  To clear the search highlight, just pass an empty string.
                          
                                  The resultCallback must take a boolean parameter.
                                  It will be called with a value of true if the subString was found;
                                  otherwise the callback value will be false.
                          
                                  Warning: It is guaranteed that the callback is always called,
                                  but it might be done during page destruction. When WebEnginePage is deleted,
                                  the callback is triggered with an invalid value and it is not safe to use
                                  the corresponding QWebEnginePage or QWebEnginePage instance inside it.
                          
                                  Args:
                                      string: string to search for
                                      backward: search backwards
                                      case_sensitive: case-sensitive search
                                      callback: result callback
                                  """
                                  if callback is None:
                          
                                      def do_nothing(x):
                                          pass
                          
                                      callback = do_nothing
                                  flag = webenginecore.QWebEnginePage.FindFlag(0)
                                  if case_sensitive:
                                      flag |= self.FindFlag.FindCaseSensitively
                                  if backward:
                                      flag |= self.FindFlag.FindBackward
                                  self.findText(string, flag, callback)
                          
                              def set_lifecycle_state(self, state: LifecycleStateStr | mod.LifecycleState):
                                  """Set lifecycle state.
                          
                                  Args:
                                      state: lifecycle state
                                  """
                                  self.setLifecycleState(LIFECYCLE_STATE.get_enum_value(state))
                          
                              def get_lifecycle_state(self) -> LifecycleStateStr:
                                  """Get the current lifecycle state.
                          
                                  Returns:
                                      lifecycle state
                                  """
                                  return LIFECYCLE_STATE.inverse[self.lifecycleState()]
                          
                              def trigger_action(self, action: WebActionStr | mod.WebAction, checked: bool = False):
                                  """Trigger action."""
                                  self.triggerAction(WEB_ACTION.get_enum_value(action), checked)
                          
                              def set_feature_permission(
                                  self,
                                  url: datatypes.UrlType,
                                  feature: FeatureStr | mod.Feature,
                                  policy: PermissionPolicyStr | mod.PermissionPolicy,
                              ):
                                  """Set permission of feature for given URL."""
                                  self.setFeaturePermission(
                                      datatypes.to_url(url),
                                      FEATURE.get_enum_value(feature),
                                      PERMISSION_POLICY.get_enum_value(policy),
                                  )
                          
                              def get_history(self) -> webenginecore.WebEngineHistory:
                                  hist = self.history()
                                  return webenginecore.WebEngineHistory(hist)
                          
                              def get_settings(self) -> webenginecore.WebEngineSettings:
                                  """Get WebEngineSettings (a MutableMapping)."""
                                  settings = self.settings()
                                  return webenginecore.WebEngineSettings(settings)
                          
                              def set_setting(
                                  self,
                                  setting_name: webenginecore.webenginesettings.WebAttributeStr,
                                  value: bool,
                              ):
                                  """Set WebEngine setting to value."""
                                  self.get_settings()[setting_name] = value
                          
                              def get_setting(
                                  self,
                                  setting_name: webenginecore.webenginesettings.WebAttributeStr,
                              ) -> bool:
                                  """Return value of given WebEngine setting."""
                                  return self.get_settings()[setting_name]
                          
                              def get_scripts(self) -> webenginecore.WebEngineScriptCollection:
                                  """Get script collection."""
                                  return webenginecore.WebEngineScriptCollection(self.scripts())
                          
                              def open_in_browser(self):
                                  """Open page URL in default system browser."""
                                  try:
                                      webbrowser.open(self.url().toString())
                                  except ValueError:
                                      logger.exception("Error opening URL %r", self.url().toString())
                          
                              def insert_stylesheet(
                                  self, name: str, css: str | os.PathLike[str], immediately: bool = True
                              ):
                                  """Load css using JavaScript.
                          
                                  Arguments:
                                      name: CSS id
                                      css: CSS stylesheet, either a string or a PathLike object.
                                      immediately: whether to run javascript immediately
                                  """
                                  if isinstance(css, os.PathLike):
                                      path = pathlib.Path(css)
                                      with path.open(encoding="utf-8") as f:
                                          css = f.read()
                                  s = f"""
                                  (function() {{
                                  css = document.createElement('style');
                                  css.type = 'text/css';
                                  css.id = {json.dumps(name)};
                                  document.head.appendChild(css);
                                  css.innerText = {json.dumps(css)};
                                  }})()
                                  """
                                  script = webenginecore.WebEngineScript()
                                  if immediately:
                                      self.runJavaScript(s, script.ScriptWorldId.ApplicationWorld)
                                  script.setName(name)
                                  script.setSourceCode(s)
                                  script.setInjectionPoint(script.InjectionPoint.DocumentReady)
                                  script.setRunsOnSubFrames(True)
                                  script.setWorldId(script.ScriptWorldId.ApplicationWorld)
                                  self.scripts().insert(script)
                          
                              def mousedown(self, selector: str, btn: Literal["left", "middle", "right"]):
                                  """Simulate a mousedown event on the targeted element.
                          
                                  Arguments:
                                      selector: A CSS3 selector to targeted element
                                      btn: Mouse button
                                  """
                                  btn_id = dict(left=0, middle=1, right=2)[btn]
                                  return self.runJavaScript(
                                      f"""
                                      (function () {{
                                          var element = document.querySelector({selector!r});
                                          var evt = document.createEvent("MouseEvents");
                                          evt.initMouseEvent("mousedown", true, true, window,
                                                             1, 1, 1, 1, 1, false, false, false, false,
                                                             {btn_id!r}, element);
                                          return element.dispatchEvent(evt);
                                      }})();
                                  """
                                  )
                          
                              def set_input_value(self, selector: str, value):
                                  """Set the value of the input matched by given selector."""
                                  script = f'document.querySelector({selector!r}).setAttribute("value", "{value}")'
                                  self.runJavaScript(script)
                          

                          find_text(string: str, backward: bool = False, case_sensitive: bool = False, callback: Callable[[bool], None] | None = None)

                          Find text in the current page.

                          Finds the specified string, subString, in the page, using the given options. The findTextFinished() signal is emitted when a string search is completed.

                          To clear the search highlight, just pass an empty string.

                          The resultCallback must take a boolean parameter. It will be called with a value of true if the subString was found; otherwise the callback value will be false.

                          Warning: It is guaranteed that the callback is always called, but it might be done during page destruction. When WebEnginePage is deleted, the callback is triggered with an invalid value and it is not safe to use the corresponding QWebEnginePage or QWebEnginePage instance inside it.

                          Parameters:

                          Name Type Description Default
                          string str

                          string to search for

                          required
                          backward bool

                          search backwards

                          False
                          case_sensitive bool

                          case-sensitive search

                          False
                          callback Callable[[bool], None] | None

                          result callback

                          None
                          Source code in prettyqt/webenginecore/webenginepage.py
                          def find_text(
                              self,
                              string: str,
                              backward: bool = False,
                              case_sensitive: bool = False,
                              callback: Callable[[bool], None] | None = None,
                          ):
                              """Find text in the current page.
                          
                              Finds the specified string, subString, in the page, using the given options.
                              The findTextFinished() signal is emitted when a string search is completed.
                          
                              To clear the search highlight, just pass an empty string.
                          
                              The resultCallback must take a boolean parameter.
                              It will be called with a value of true if the subString was found;
                              otherwise the callback value will be false.
                          
                              Warning: It is guaranteed that the callback is always called,
                              but it might be done during page destruction. When WebEnginePage is deleted,
                              the callback is triggered with an invalid value and it is not safe to use
                              the corresponding QWebEnginePage or QWebEnginePage instance inside it.
                          
                              Args:
                                  string: string to search for
                                  backward: search backwards
                                  case_sensitive: case-sensitive search
                                  callback: result callback
                              """
                              if callback is None:
                          
                                  def do_nothing(x):
                                      pass
                          
                                  callback = do_nothing
                              flag = webenginecore.QWebEnginePage.FindFlag(0)
                              if case_sensitive:
                                  flag |= self.FindFlag.FindCaseSensitively
                              if backward:
                                  flag |= self.FindFlag.FindBackward
                              self.findText(string, flag, callback)
                          

                          get_icon() -> gui.Icon | None

                          Return icon. If icon is Null, return None.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def get_icon(self) -> gui.Icon | None:
                              """Return icon. If icon is Null, return None."""
                              icon = self.icon()
                              return None if icon.isNull() else gui.Icon(icon)
                          

                          get_lifecycle_state() -> LifecycleStateStr

                          Get the current lifecycle state.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def get_lifecycle_state(self) -> LifecycleStateStr:
                              """Get the current lifecycle state.
                          
                              Returns:
                                  lifecycle state
                              """
                              return LIFECYCLE_STATE.inverse[self.lifecycleState()]
                          

                          get_scripts() -> webenginecore.WebEngineScriptCollection

                          Get script collection.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def get_scripts(self) -> webenginecore.WebEngineScriptCollection:
                              """Get script collection."""
                              return webenginecore.WebEngineScriptCollection(self.scripts())
                          

                          get_setting(setting_name: webenginecore.webenginesettings.WebAttributeStr) -> bool

                          Return value of given WebEngine setting.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def get_setting(
                              self,
                              setting_name: webenginecore.webenginesettings.WebAttributeStr,
                          ) -> bool:
                              """Return value of given WebEngine setting."""
                              return self.get_settings()[setting_name]
                          

                          get_settings() -> webenginecore.WebEngineSettings

                          Get WebEngineSettings (a MutableMapping).

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def get_settings(self) -> webenginecore.WebEngineSettings:
                              """Get WebEngineSettings (a MutableMapping)."""
                              settings = self.settings()
                              return webenginecore.WebEngineSettings(settings)
                          

                          insert_stylesheet(name: str, css: str | os.PathLike[str], immediately: bool = True)

                          Load css using JavaScript.

                          Parameters:

                          Name Type Description Default
                          name str

                          CSS id

                          required
                          css str | PathLike[str]

                          CSS stylesheet, either a string or a PathLike object.

                          required
                          immediately bool

                          whether to run javascript immediately

                          True
                          Source code in prettyqt/webenginecore/webenginepage.py
                          def insert_stylesheet(
                              self, name: str, css: str | os.PathLike[str], immediately: bool = True
                          ):
                              """Load css using JavaScript.
                          
                              Arguments:
                                  name: CSS id
                                  css: CSS stylesheet, either a string or a PathLike object.
                                  immediately: whether to run javascript immediately
                              """
                              if isinstance(css, os.PathLike):
                                  path = pathlib.Path(css)
                                  with path.open(encoding="utf-8") as f:
                                      css = f.read()
                              s = f"""
                              (function() {{
                              css = document.createElement('style');
                              css.type = 'text/css';
                              css.id = {json.dumps(name)};
                              document.head.appendChild(css);
                              css.innerText = {json.dumps(css)};
                              }})()
                              """
                              script = webenginecore.WebEngineScript()
                              if immediately:
                                  self.runJavaScript(s, script.ScriptWorldId.ApplicationWorld)
                              script.setName(name)
                              script.setSourceCode(s)
                              script.setInjectionPoint(script.InjectionPoint.DocumentReady)
                              script.setRunsOnSubFrames(True)
                              script.setWorldId(script.ScriptWorldId.ApplicationWorld)
                              self.scripts().insert(script)
                          

                          load_url(url: datatypes.UrlType | datatypes.PathType)

                          Load the URL.

                          Loads the specified url and displays it.

                          Note: The Page remains the same until enough data has arrived to display the new URL.

                          Parameters:

                          Name Type Description Default
                          url UrlType | PathType

                          URL to load

                          required
                          Source code in prettyqt/webenginecore/webenginepage.py
                          def load_url(self, url: datatypes.UrlType | datatypes.PathType):
                              """Load the URL.
                          
                              Loads the specified url and displays it.
                          
                              Note: The Page remains the same until enough data has arrived
                              to display the new URL.
                          
                              Args:
                                  url: URL to load
                              """
                              self.load(datatypes.to_url(url))
                          

                          mousedown(selector: str, btn: Literal['left', 'middle', 'right'])

                          Simulate a mousedown event on the targeted element.

                          Parameters:

                          Name Type Description Default
                          selector str

                          A CSS3 selector to targeted element

                          required
                          btn Literal['left', 'middle', 'right']

                          Mouse button

                          required
                          Source code in prettyqt/webenginecore/webenginepage.py
                          def mousedown(self, selector: str, btn: Literal["left", "middle", "right"]):
                              """Simulate a mousedown event on the targeted element.
                          
                              Arguments:
                                  selector: A CSS3 selector to targeted element
                                  btn: Mouse button
                              """
                              btn_id = dict(left=0, middle=1, right=2)[btn]
                              return self.runJavaScript(
                                  f"""
                                  (function () {{
                                      var element = document.querySelector({selector!r});
                                      var evt = document.createEvent("MouseEvents");
                                      evt.initMouseEvent("mousedown", true, true, window,
                                                         1, 1, 1, 1, 1, false, false, false, false,
                                                         {btn_id!r}, element);
                                      return element.dispatchEvent(evt);
                                  }})();
                              """
                              )
                          

                          open_in_browser()

                          Open page URL in default system browser.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def open_in_browser(self):
                              """Open page URL in default system browser."""
                              try:
                                  webbrowser.open(self.url().toString())
                              except ValueError:
                                  logger.exception("Error opening URL %r", self.url().toString())
                          

                          set_feature_permission(url: datatypes.UrlType, feature: FeatureStr | mod.Feature, policy: PermissionPolicyStr | mod.PermissionPolicy)

                          Set permission of feature for given URL.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def set_feature_permission(
                              self,
                              url: datatypes.UrlType,
                              feature: FeatureStr | mod.Feature,
                              policy: PermissionPolicyStr | mod.PermissionPolicy,
                          ):
                              """Set permission of feature for given URL."""
                              self.setFeaturePermission(
                                  datatypes.to_url(url),
                                  FEATURE.get_enum_value(feature),
                                  PERMISSION_POLICY.get_enum_value(policy),
                              )
                          

                          set_input_value(selector: str, value)

                          Set the value of the input matched by given selector.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def set_input_value(self, selector: str, value):
                              """Set the value of the input matched by given selector."""
                              script = f'document.querySelector({selector!r}).setAttribute("value", "{value}")'
                              self.runJavaScript(script)
                          

                          set_lifecycle_state(state: LifecycleStateStr | mod.LifecycleState)

                          Set lifecycle state.

                          Parameters:

                          Name Type Description Default
                          state LifecycleStateStr | LifecycleState

                          lifecycle state

                          required
                          Source code in prettyqt/webenginecore/webenginepage.py
                          def set_lifecycle_state(self, state: LifecycleStateStr | mod.LifecycleState):
                              """Set lifecycle state.
                          
                              Args:
                                  state: lifecycle state
                              """
                              self.setLifecycleState(LIFECYCLE_STATE.get_enum_value(state))
                          

                          set_setting(setting_name: webenginecore.webenginesettings.WebAttributeStr, value: bool)

                          Set WebEngine setting to value.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def set_setting(
                              self,
                              setting_name: webenginecore.webenginesettings.WebAttributeStr,
                              value: bool,
                          ):
                              """Set WebEngine setting to value."""
                              self.get_settings()[setting_name] = value
                          

                          set_url(url: datatypes.PathType | datatypes.UrlType)

                          Set the url of the WebEnginePage.

                          Clears the Page and loads the URL.

                          Parameters:

                          Name Type Description Default
                          url PathType | UrlType

                          URL to set

                          required
                          Source code in prettyqt/webenginecore/webenginepage.py
                          def set_url(self, url: datatypes.PathType | datatypes.UrlType):
                              """Set the url of the WebEnginePage.
                          
                              Clears the Page and loads the URL.
                          
                              Args:
                                  url: URL to set
                              """
                              self.setUrl(datatypes.to_url(url))
                          

                          set_zoom(zoom: float)

                          Set the zoom factor for the Page.

                          Valid values are within the range from 0.25 to 5.0. The default factor is 1.0.

                          Parameters:

                          Name Type Description Default
                          zoom float

                          Zoom factor

                          required
                          Source code in prettyqt/webenginecore/webenginepage.py
                          def set_zoom(self, zoom: float):
                              """Set the zoom factor for the Page.
                          
                              Valid values are within the range from 0.25 to 5.0. The default factor is 1.0.
                          
                              Args:
                                  zoom: Zoom factor
                              """
                              self.setZoomFactor(zoom)
                          

                          trigger_action(action: WebActionStr | mod.WebAction, checked: bool = False)

                          Trigger action.

                          Source code in prettyqt/webenginecore/webenginepage.py
                          def trigger_action(self, action: WebActionStr | mod.WebAction, checked: bool = False):
                              """Trigger action."""
                              self.triggerAction(WEB_ACTION.get_enum_value(action), checked)
                          

                          WebEnginePermission

                          Bases: QWebEnginePermission

                          Represents a permission request or stored permission for a web origin.

                          Source code in prettyqt/webenginecore/webenginepermission.py
                          class WebEnginePermission(QtWebEngineCore.QWebEnginePermission):
                              """Represents a permission request or stored permission for a web origin."""
                          
                              def __repr__(self):
                                  return get_repr(
                                      self,
                                      self.get_origin(),
                                      self.get_permission_type(),
                                      self.get_state(),
                                  )
                          
                              def __bool__(self):
                                  return self.isValid()
                          
                              def get_origin(self) -> core.Url:
                                  """Return the origin URL associated with this permission."""
                                  return core.Url(self.origin())
                          
                              def get_permission_type(self) -> PermissionTypeStr:
                                  """Return the permission type."""
                                  return PERMISSION_TYPE.inverse[self.permissionType()]
                          
                              def get_state(self) -> StateStr:
                                  """Return the current permission state."""
                                  return STATE.inverse[self.state()]
                          
                              @classmethod
                              def is_persistent(
                                  cls, permission_type: PermissionTypeStr | mod.PermissionType
                              ) -> bool:
                                  """Return whether the given permission type is persistent."""
                                  return cls.isPersistent(PERMISSION_TYPE.get_enum_value(permission_type))
                          

                          get_origin() -> core.Url

                          Return the origin URL associated with this permission.

                          Source code in prettyqt/webenginecore/webenginepermission.py
                          def get_origin(self) -> core.Url:
                              """Return the origin URL associated with this permission."""
                              return core.Url(self.origin())
                          

                          get_permission_type() -> PermissionTypeStr

                          Return the permission type.

                          Source code in prettyqt/webenginecore/webenginepermission.py
                          def get_permission_type(self) -> PermissionTypeStr:
                              """Return the permission type."""
                              return PERMISSION_TYPE.inverse[self.permissionType()]
                          

                          get_state() -> StateStr

                          Return the current permission state.

                          Source code in prettyqt/webenginecore/webenginepermission.py
                          def get_state(self) -> StateStr:
                              """Return the current permission state."""
                              return STATE.inverse[self.state()]
                          

                          is_persistent(permission_type: PermissionTypeStr | mod.PermissionType) -> bool classmethod

                          Return whether the given permission type is persistent.

                          Source code in prettyqt/webenginecore/webenginepermission.py
                          @classmethod
                          def is_persistent(
                              cls, permission_type: PermissionTypeStr | mod.PermissionType
                          ) -> bool:
                              """Return whether the given permission type is persistent."""
                              return cls.isPersistent(PERMISSION_TYPE.get_enum_value(permission_type))
                          

                          WebEngineProfile

                          Bases: ObjectMixin, QWebEngineProfile

                          Source code in prettyqt/webenginecore/webengineprofile.py
                          class WebEngineProfile(core.ObjectMixin, webenginecore.QWebEngineProfile):
                              def set_persistent_cookie_policy(
                                  self, policy: PersistentCookiePolicyStr | mod.PersistentCookiesPolicy
                              ):
                                  """Set the persistent cookie policy.
                          
                                  Args:
                                      policy: persistent cookie policy
                                  """
                                  self.setPersistentCookiesPolicy(PERSISTENT_COOKIE_POLICY.get_enum_value(policy))
                          
                              def get_persistent_cookie_policy(self) -> PersistentCookiePolicyStr:
                                  """Return current persistent cookie policy.
                          
                                  Returns:
                                      Persistent cookie policy
                                  """
                                  return PERSISTENT_COOKIE_POLICY.inverse[self.persistentCookiesPolicy()]
                          
                              def set_http_cache_type(self, typ: HttpCacheTypeStr | mod.HttpCacheType):
                                  """Set the http cache type.
                          
                                  Args:
                                      typ: http cache type
                                  """
                                  self.setHttpCacheType(HTTP_CACHE_TYPE.get_enum_value(typ))
                          
                              def get_http_cache_type(self) -> HttpCacheTypeStr:
                                  """Return current http cache type.
                          
                                  Returns:
                                      Http cache type
                                  """
                                  return HTTP_CACHE_TYPE.inverse[self.httpCacheType()]
                          
                              def install_url_scheme_handler(
                                  self,
                                  scheme: str,
                                  callback: Callable[[QWebEngineUrlRequestJob], Any],
                              ):
                                  """Install a URL scheme handler."""
                                  handler = CallbackWebEngineUrlSchemeHandler(callback, parent=self)
                                  self.installUrlSchemeHandler(scheme.encode(), handler)
                          
                              def get_scripts(self) -> webenginecore.WebEngineScriptCollection:
                                  return webenginecore.WebEngineScriptCollection(self.scripts())
                          

                          get_http_cache_type() -> HttpCacheTypeStr

                          Return current http cache type.

                          Source code in prettyqt/webenginecore/webengineprofile.py
                          def get_http_cache_type(self) -> HttpCacheTypeStr:
                              """Return current http cache type.
                          
                              Returns:
                                  Http cache type
                              """
                              return HTTP_CACHE_TYPE.inverse[self.httpCacheType()]
                          

                          Return current persistent cookie policy.

                          Source code in prettyqt/webenginecore/webengineprofile.py
                          def get_persistent_cookie_policy(self) -> PersistentCookiePolicyStr:
                              """Return current persistent cookie policy.
                          
                              Returns:
                                  Persistent cookie policy
                              """
                              return PERSISTENT_COOKIE_POLICY.inverse[self.persistentCookiesPolicy()]
                          

                          install_url_scheme_handler(scheme: str, callback: Callable[[QWebEngineUrlRequestJob], Any])

                          Install a URL scheme handler.

                          Source code in prettyqt/webenginecore/webengineprofile.py
                          def install_url_scheme_handler(
                              self,
                              scheme: str,
                              callback: Callable[[QWebEngineUrlRequestJob], Any],
                          ):
                              """Install a URL scheme handler."""
                              handler = CallbackWebEngineUrlSchemeHandler(callback, parent=self)
                              self.installUrlSchemeHandler(scheme.encode(), handler)
                          

                          set_http_cache_type(typ: HttpCacheTypeStr | mod.HttpCacheType)

                          Set the http cache type.

                          Parameters:

                          Name Type Description Default
                          typ HttpCacheTypeStr | HttpCacheType

                          http cache type

                          required
                          Source code in prettyqt/webenginecore/webengineprofile.py
                          def set_http_cache_type(self, typ: HttpCacheTypeStr | mod.HttpCacheType):
                              """Set the http cache type.
                          
                              Args:
                                  typ: http cache type
                              """
                              self.setHttpCacheType(HTTP_CACHE_TYPE.get_enum_value(typ))
                          

                          Set the persistent cookie policy.

                          Parameters:

                          Name Type Description Default
                          policy PersistentCookiePolicyStr | PersistentCookiesPolicy

                          persistent cookie policy

                          required
                          Source code in prettyqt/webenginecore/webengineprofile.py
                          def set_persistent_cookie_policy(
                              self, policy: PersistentCookiePolicyStr | mod.PersistentCookiesPolicy
                          ):
                              """Set the persistent cookie policy.
                          
                              Args:
                                  policy: persistent cookie policy
                              """
                              self.setPersistentCookiesPolicy(PERSISTENT_COOKIE_POLICY.get_enum_value(policy))
                          

                          WebEngineScript

                          Bases: QWebEngineScript

                          Source code in prettyqt/webenginecore/webenginescript.py
                          class WebEngineScript(QtWebEngineCore.QWebEngineScript):
                              def set_injection_point(
                                  self, point: InjectionPointStr | QtWebEngineCore.QWebEngineScript.InjectionPoint
                              ):
                                  """Set injection point.
                          
                                  Args:
                                      point: injection point to use
                                  """
                                  self.setInjectionPoint(INJECTION_POINT.get_enum_value(point))
                          
                              def get_injection_point(self) -> InjectionPointStr:
                                  """Return injection point.
                          
                                  Returns:
                                      injection point
                                  """
                                  return INJECTION_POINT.inverse[self.injectionPoint()]
                          

                          get_injection_point() -> InjectionPointStr

                          Return injection point.

                          Source code in prettyqt/webenginecore/webenginescript.py
                          def get_injection_point(self) -> InjectionPointStr:
                              """Return injection point.
                          
                              Returns:
                                  injection point
                              """
                              return INJECTION_POINT.inverse[self.injectionPoint()]
                          

                          set_injection_point(point: InjectionPointStr | QtWebEngineCore.QWebEngineScript.InjectionPoint)

                          Set injection point.

                          Parameters:

                          Name Type Description Default
                          point InjectionPointStr | InjectionPoint

                          injection point to use

                          required
                          Source code in prettyqt/webenginecore/webenginescript.py
                          def set_injection_point(
                              self, point: InjectionPointStr | QtWebEngineCore.QWebEngineScript.InjectionPoint
                          ):
                              """Set injection point.
                          
                              Args:
                                  point: injection point to use
                              """
                              self.setInjectionPoint(INJECTION_POINT.get_enum_value(point))
                          

                          WebEngineSettings

                          Bases: MutableMapping

                          Source code in prettyqt/webenginecore/webenginesettings.py
                          class WebEngineSettings(MutableMapping):
                              def __init__(self, item: QtWebEngineCore.QWebEngineSettings):
                                  self.item = item
                          
                              def __repr__(self):
                                  return get_repr(self, dict(self))
                          
                              def __getattr__(self, val):
                                  return getattr(self.item, val)
                          
                              def __setitem__(self, index: WebAttributeStr, value: bool):
                                  self.item.setAttribute(WEB_ATTRIBUTES[index], value)
                          
                              def __getitem__(self, index: WebAttributeStr) -> bool:
                                  if index not in WEB_ATTRIBUTES:
                                      raise KeyError(index)
                                  return self.item.testAttribute(WEB_ATTRIBUTES[index])
                          
                              def __delitem__(self, index: WebAttributeStr):
                                  return self.item.resetAttribute(WEB_ATTRIBUTES[index])
                          
                              def __iter__(self):
                                  return iter(WEB_ATTRIBUTES.keys())
                          
                              def __len__(self):
                                  return len(WEB_ATTRIBUTES)
                          
                              def set_unknown_url_scheme_policy(self, policy: UnknownUrlSchemePolicyStr | pol):
                                  """Set the unknown url scheme policy.
                          
                                  Args:
                                      policy: unknown url scheme policy
                                  """
                                  self.item.setUnknownUrlSchemePolicy(
                                      UNKNOWN_URL_SCHEME_POLICY.get_enum_value(policy)
                                  )
                          
                              def get_unknown_url_scheme_policy(self) -> UnknownUrlSchemePolicyStr:
                                  """Return current unknown url scheme policy.
                          
                                  Returns:
                                      Unknown url scheme policy
                                  """
                                  return UNKNOWN_URL_SCHEME_POLICY.inverse[self.item.unknownUrlSchemePolicy()]
                          
                              def set_font_family(
                                  self,
                                  which: FontFamilyStr | QtWebEngineCore.QWebEngineSettings.FontFamily,
                                  family: str,
                              ):
                                  """Set the actual font family to family for the specified generic family, which.
                          
                                  Args:
                                      which: family to set
                                      family: generic family
                                  """
                                  self.item.setFontFamily(FONT_FAMILY.get_enum_value(which), family)
                          
                              def get_font_family(
                                  self, family: FontFamilyStr | QtWebEngineCore.QWebEngineSettings.FontFamily
                              ) -> str:
                                  """Return the actual font family for the specified generic font family.
                          
                                  Args:
                                      family: generic font family
                          
                                  Returns:
                                      Font family
                                  """
                                  return self.item.fontFamily(FONT_FAMILY.get_enum_value(family))
                          
                              def set_font_size(
                                  self, typ: FontSizeStr | QtWebEngineCore.QWebEngineSettings.FontSize, size: int
                              ):
                                  """Set the font size for type to size in pixels.
                          
                                  Args:
                                      typ: font size type
                                      size: size in pixels
                                  """
                                  self.item.setFontSize(FONT_SIZE.get_enum_value(typ), size)
                          
                              def get_font_size(
                                  self, typ: FontSizeStr | QtWebEngineCore.QWebEngineSettings.FontSize
                              ) -> int:
                                  """Return the default font size for type in pixels.
                          
                                  Args:
                                      typ: font size type
                          
                                  Returns:
                                      Font size
                                  """
                                  return self.item.fontSize(FONT_SIZE.get_enum_value(typ))
                          

                          get_font_family(family: FontFamilyStr | QtWebEngineCore.QWebEngineSettings.FontFamily) -> str

                          Return the actual font family for the specified generic font family.

                          Parameters:

                          Name Type Description Default
                          family FontFamilyStr | FontFamily

                          generic font family

                          required
                          Source code in prettyqt/webenginecore/webenginesettings.py
                          def get_font_family(
                              self, family: FontFamilyStr | QtWebEngineCore.QWebEngineSettings.FontFamily
                          ) -> str:
                              """Return the actual font family for the specified generic font family.
                          
                              Args:
                                  family: generic font family
                          
                              Returns:
                                  Font family
                              """
                              return self.item.fontFamily(FONT_FAMILY.get_enum_value(family))
                          

                          get_font_size(typ: FontSizeStr | QtWebEngineCore.QWebEngineSettings.FontSize) -> int

                          Return the default font size for type in pixels.

                          Parameters:

                          Name Type Description Default
                          typ FontSizeStr | FontSize

                          font size type

                          required
                          Source code in prettyqt/webenginecore/webenginesettings.py
                          def get_font_size(
                              self, typ: FontSizeStr | QtWebEngineCore.QWebEngineSettings.FontSize
                          ) -> int:
                              """Return the default font size for type in pixels.
                          
                              Args:
                                  typ: font size type
                          
                              Returns:
                                  Font size
                              """
                              return self.item.fontSize(FONT_SIZE.get_enum_value(typ))
                          

                          get_unknown_url_scheme_policy() -> UnknownUrlSchemePolicyStr

                          Return current unknown url scheme policy.

                          Source code in prettyqt/webenginecore/webenginesettings.py
                          def get_unknown_url_scheme_policy(self) -> UnknownUrlSchemePolicyStr:
                              """Return current unknown url scheme policy.
                          
                              Returns:
                                  Unknown url scheme policy
                              """
                              return UNKNOWN_URL_SCHEME_POLICY.inverse[self.item.unknownUrlSchemePolicy()]
                          

                          set_font_family(which: FontFamilyStr | QtWebEngineCore.QWebEngineSettings.FontFamily, family: str)

                          Set the actual font family to family for the specified generic family, which.

                          Parameters:

                          Name Type Description Default
                          which FontFamilyStr | FontFamily

                          family to set

                          required
                          family str

                          generic family

                          required
                          Source code in prettyqt/webenginecore/webenginesettings.py
                          def set_font_family(
                              self,
                              which: FontFamilyStr | QtWebEngineCore.QWebEngineSettings.FontFamily,
                              family: str,
                          ):
                              """Set the actual font family to family for the specified generic family, which.
                          
                              Args:
                                  which: family to set
                                  family: generic family
                              """
                              self.item.setFontFamily(FONT_FAMILY.get_enum_value(which), family)
                          

                          set_font_size(typ: FontSizeStr | QtWebEngineCore.QWebEngineSettings.FontSize, size: int)

                          Set the font size for type to size in pixels.

                          Parameters:

                          Name Type Description Default
                          typ FontSizeStr | FontSize

                          font size type

                          required
                          size int

                          size in pixels

                          required
                          Source code in prettyqt/webenginecore/webenginesettings.py
                          def set_font_size(
                              self, typ: FontSizeStr | QtWebEngineCore.QWebEngineSettings.FontSize, size: int
                          ):
                              """Set the font size for type to size in pixels.
                          
                              Args:
                                  typ: font size type
                                  size: size in pixels
                              """
                              self.item.setFontSize(FONT_SIZE.get_enum_value(typ), size)
                          

                          set_unknown_url_scheme_policy(policy: UnknownUrlSchemePolicyStr | pol)

                          Set the unknown url scheme policy.

                          Parameters:

                          Name Type Description Default
                          policy UnknownUrlSchemePolicyStr | pol

                          unknown url scheme policy

                          required
                          Source code in prettyqt/webenginecore/webenginesettings.py
                          def set_unknown_url_scheme_policy(self, policy: UnknownUrlSchemePolicyStr | pol):
                              """Set the unknown url scheme policy.
                          
                              Args:
                                  policy: unknown url scheme policy
                              """
                              self.item.setUnknownUrlSchemePolicy(
                                  UNKNOWN_URL_SCHEME_POLICY.get_enum_value(policy)
                              )
                          

                          WebEngineUrlScheme

                          Bases: QWebEngineUrlScheme

                          Source code in prettyqt/webenginecore/webengineurlscheme.py
                          class WebEngineUrlScheme(QtWebEngineCore.QWebEngineUrlScheme):
                              def get_name(self) -> str:
                                  return bytes(self.name().data()).decode()
                          
                              @classmethod
                              def get_scheme_by_name(cls, name: datatypes.ByteArrayType) -> Self:
                                  scheme = cls.schemeByName(datatypes.to_bytearray(name))
                                  return cls(scheme)
                          
                              def set_name(self, name: datatypes.ByteArrayType):
                                  self.setName(datatypes.to_bytearray(name))
                          
                              def set_syntax(self, syntax: SyntaxStr | QWebEngineUrlScheme.Syntax):
                                  """Set syntax.
                          
                                  Args:
                                      syntax: syntax to use
                                  """
                                  self.setSyntax(SYNTAX.get_enum_value(syntax))
                          
                              def get_syntax(self) -> SyntaxStr:
                                  """Return syntax.
                          
                                  Returns:
                                      syntax
                                  """
                                  return SYNTAX.inverse[self.syntax()]
                          

                          get_syntax() -> SyntaxStr

                          Return syntax.

                          Source code in prettyqt/webenginecore/webengineurlscheme.py
                          def get_syntax(self) -> SyntaxStr:
                              """Return syntax.
                          
                              Returns:
                                  syntax
                              """
                              return SYNTAX.inverse[self.syntax()]
                          

                          set_syntax(syntax: SyntaxStr | QWebEngineUrlScheme.Syntax)

                          Set syntax.

                          Parameters:

                          Name Type Description Default
                          syntax SyntaxStr | Syntax

                          syntax to use

                          required
                          Source code in prettyqt/webenginecore/webengineurlscheme.py
                          def set_syntax(self, syntax: SyntaxStr | QWebEngineUrlScheme.Syntax):
                              """Set syntax.
                          
                              Args:
                                  syntax: syntax to use
                              """
                              self.setSyntax(SYNTAX.get_enum_value(syntax))