WebView displays web pages and provides all the standard browsing functionality.
Since the Qt WebEngine dependency is hefty and difficult to install on some systems, it is possible for sclang to have been built without WebView support (using the CMake flag -DSC_USE_QTWEBENGINE=OFF
at compile). If so, attempting to invoke this class will throw an error.
Clears the cache for all browser instances.
Set or clear a function to handle a specific URL prefix (e.g. mail://)
prefix |
URL prefix. For mail:///, use the string "mail" (do not append "://") |
function |
Function to execute when any WebView loads a URL with this prefix. First argument is the URL. |
Gets the current URL, or navigates to a new one. This is equivalent to entering a URL in a browser's URL box.
Navigate to a url. This is equivalent to clicking a link on a page - after a navigate call, back will return you to the previous page.
Navigates to the previous page in history.
Navigates to the next page in history.
Finds and selects the next instance of given text on the current page. When the given text changes, the search starts anew.
text |
The text to find; a String. |
reversed |
Whether to search in reverse direction; a Boolean. |
func |
A function, called when the operation is finished. If the text was found this function is passed |
Trigger an action on the current page. Possible actions include: reload, select all, copy, undo, redo (see QWebPageAction)
action |
A QWebPageAction. |
checked |
A Boolean to enable or disable the action (applies to only some actions). |
Set the HTML displayed in the view.
html |
A String. |
baseUrl |
A url. The browser will interpret this to be the current page location. |
Set the raw content of a web view. This can be used to display binary data such as image / movie files.
data |
An Int8Array containing data. |
mimeType |
A mime type, of the form e.g. "image/jpeg" |
baseUrl |
A url. The browser will interpret this to be the current page location. |
Set a QWebAttribute for the view. Attributes can affect behavior such as caching, auto-loading images, file url access, etc.
attribute |
A QWebAttribute. |
on |
A Boolean. |
Check the enablement state of a QWebAttribute.
attribute |
A QWebAttribute. |
A Boolean.
Reset the enablement state of a QWebAttribute.
attribute |
A QWebAttribute. |
Convert the page to plain text.
func |
A callback function. Called with the resulting plain text string when the operation is finished. |
Fetch the HTML of the current page.
func |
A callback function. Called with the resulting HTML string when the operation is finished. |
The title of the current page.
A String.
The requested url for the current page.
A String.
The currently selected text.
A String.
Get or set audio mute setting for the view;
muted |
A Boolean. |
Get the size of the current content.
A Point
Get or sets the scroll position of the current page.
A Point
Returns whether the page has a text selection.
A Boolean.
Whether pressing Ctrl+Return or Ctrl+Enter while some text is selected should evaluate the selection as SuperCollider code.
b |
A Boolean. |
Sets a specific font family to be used in place of a CSS-specified generic font family.
which |
The CSS generic font family to assign a font to; one of QWebFontFamily |
font |
A font family name to be assigned to the generic family; a String. |
Gets or sets the zoom level on a page.
zoom |
A Number, where 1.0 is the default zoom. |
Get or set whether the entire web page is editable.
b |
A Boolean. |
Get or set the default background color of web pages.
color |
A Color. |
Sets the object to be evaluated when the mute setting of the view has changed.
Sets the object to be evaluated when the page has started or stopped playing audio.
Sets the object to be evaluated when the contents size of the view has changed
Sets the object to be evaluated when the scroll position on a page has changed.
Sets the object to be evaluated when the text selection on a page has changed.
Sets the object to be evaluated when a javascript console message is posted.
Sets the object to be evaluated when a the mouse rolls over a link.
Sets the object to be evaluated when the title of the displayed page changes.
Sets the object to be evaluated when the url of the displayed page changes.
Sets the object to be evaluated with load progress updates.
Sets the object to be evaluated when a page load begins.
Sets the object to be evaluated when a page has loaded successfully, passing the view as the argument.
Sets the object to be evaluated when a page has failed to load, passing the view as the argument.
When true, page navigation requests will not be handled. Use in combination with onLinkActivated to provide custom navigation behavior.
Sets the object to be evaluated when the user triggers a link. Arguments are: a URL, a QWebPageNavigationType, a bool (page is opening in current view).
When this is set to other than nil, WebView will stop handling clicked links altogether. Setting this to nil will restore WebView link handling again. Note: for specialty behavior when clicking on links, it is much better to use setUrlHandler in most cases.
Sets the object to be evaluated whenever a page reload is requested, passing the view and the URL to be reloaded (as String) as the arguments.
Evaluates the given JavaScript code in the context of the current page.
javascript |
A String. |
func |
A function to be called when execution is complete, with the result as first argument. NOTE: javascript code can correctly return Numbers, Strings and Arrays, but it can't currently pass javascript Objects to sclang. It is possible however to use JSON serialization to acheive this:
|