# eric6.WebBrowser.WebBrowserView

Module implementing the web browser using QWebEngineView.

### Global Attributes

None

### Classes

WebBrowserView | Class implementing the web browser view widget.

### Functions

None

## WebBrowserView

Class implementing the web browser view widget.

### Signals

backwardAvailable(bool)
  emitted after the current URL has changed
faviconChanged()
  emitted to signal a changed web site icon
forwardAvailable(bool)
  emitted after the current URL has changed
highlighted(str)
  emitted, when the mouse hovers over a link
safeBrowsingAbort()
  emitted to indicate an abort due to a safe browsing event
safeBrowsingBad(threatType, threatMessages)
  emitted to indicate a malicious web site as determined by safe browsing
search(QUrl)
  emitted, when a search is requested
sourceChanged(QUrl)
  emitted after the current URL has changed
zoomValueChanged(int)
  emitted to signal a change of the zoom value

### Derived from

QWebEngineView

### Class Attributes

ZoomLevelDefault
ZoomLevels

### Class Methods

None

### Methods

WebBrowserView | Constructor
__addBookmarkCallback | Private callback method of __addBookmark().
__addSearchEngine | Private slot to add a new search engine.
__addSpeedDial | Private slot to add a new speed dial.
__adjustBookmark | Private slot to adjust the 'lastModified' value of bookmarks.
__blockImage | Private slot to add a block rule for an image URL.
__bookmarkLink | Private slot to bookmark a link via the context menu.
__checkForForm | Private method to check the given position for an open search form.
__checkForFormCallback | Private method handling the __checkForForm result.
__configureSpeedDial | Private slot to configure the speed dial.
__copyImage | Private slot to copy an image to the clipboard.
__copyLink | Private slot to copy a link to the clipboard.
__createContextMenu | Private method to populate the context menu.
__createImageContextMenu | Private method to populate the context menu for images.
__createLinkContextMenu | Private method to populate the context menu for URLs.
__createMediaContextMenu | Private method to populate the context menu for media elements.
__createNewPage | Private method to create a new page object.
__createPageContextMenu | Private method to populate the basic context menu.
__createSelectedTextContextMenu | Private method to populate the context menu for selected text.
__currentEngineChanged | Private slot to track a change of the current search engine.
__downloadImage | Private slot to download an image and save it to disk.
__downloadLink | Private slot to download a link and save it to disk.
__downloadMedia | Private slot to download a media and save it to disk.
__getSavePageFileNameAndFormat | Private method to get the file name to save the page to.
__iconLoaded | Private slot handling the loaded web site icon.
__iconUrlChanged | Private slot to handle the iconUrlChanged signal.
__isUrlValid | Private method to check a URL for validity.
__levelForZoom | Private method determining the zoom level index given a zoom factor.
__linkHovered | Private slot to handle the linkHovered signal.
__loadFinished | Private method to handle the loadFinished signal.
__loadProgress | Private method to handle the loadProgress signal.
__loadStarted | Private method to handle the loadStarted signal.
__muteMedia | Private slot to (un)mute the selected media.
__openLinkInNewPrivateWindow | Private slot called by the context menu to open a link in a new private window.
__openLinkInNewTab | Private method called by the context menu to open a link in a new tab.
__openLinkInNewWindow | Private slot called by the context menu to open a link in a new window.
__pauseMedia | Private slot to pause or play the selected media.
__reloadAllSpeedDials | Private slot to reload all speed dials.
__renderPreview | Private slot to render a preview pixmap after the page was loaded.
__renderProcessTerminated | Private slot handling a crash of the web page render process.
__replaceMisspelledWord | Private slot to replace a misspelled word under the context menu.
__resetSpeedDials | Private slot to reset all speed dials to the default pages.
__searchDefaultRequested | Private slot to search for some text with the current search engine.
__searchImage | Private slot to search for an image URL.
__searchRequested | Private slot to search for some text with a selected search engine.
__sendLink | Private slot to send a link via email.
__setRwhvqt | Private slot to set widget that receives input events.
__showEventSlot | Private slot to perform actions when the view is shown and the event loop is running.
__showTabCrashPage | Private slot to show the tab crash page.
__urlChanged | Private slot to handle the urlChanged signal.
__virusTotal | Private slot to scan the selected URL with VirusTotal.
__webInspector | Private slot to show the web inspector window.
_contextMenuEvent | Protected method called to create a context menu.
_gestureEvent | Protected method handling gesture events.
_keyPressEvent | Protected method called by a key press.
_keyReleaseEvent | Protected method called by a key release.
_mouseMoveEvent | Protected method to handle mouse move events.
_mousePressEvent | Protected method called by a mouse press event.
_mouseReleaseEvent | Protected method called by a mouse release event.
_wheelEvent | Protected method to handle wheel events.
activateSession | Public slot to activate a restored session.
addBookmark | Public slot to bookmark the current page.
backward | Public slot to move backwards in history.
checkRSS | Public method to check, if the loaded page contains feed links.
clearHistory | Public slot to clear the history.
closeWebInspector | Public slot to close the web inspector.
contextMenuEvent | Protected method called to create a context menu.
copy | Public slot to copy the selected text.
createWindow | Public method called, when a new window should be created.
cut | Public slot to cut the selected text.
documentTitle | Public method to return the title of the loaded page.
dragEnterEvent | Protected method called by a drag enter event.
dragMoveEvent | Protected method called by a drag move event.
dropEvent | Protected method called by a drop event.
event | Public method handling events.
eventFilter | Public method to process event for other objects.
extractSessionMetaData | Public method to extract some session meta data elements needed by the tab widget in case of deferred loading.
findNextPrev | Public slot to find the next occurrence of a text.
forward | Public slot to move forward in history.
getPreview | Public method to get the preview pixmap.
getRSS | Public method to get the extracted RSS feeds.
getSafeBrowsingStatus | Public method to get the safe browsing status of the current page.
getSessionData | Public method to populate the session data.
hasRSS | Public method to check, if the loaded page has RSS links.
hasSelection | Public method to determine, if there is some text selected.
home | Public slot to move to the first page loaded.
icon | Public method to get the web site icon.
inputWidget | Public method to get a reference to the render widget.
isBackwardAvailable | Public method to determine, if a backwards move in history is possible.
isForwardAvailable | Public method to determine, if a forward move in history is possible.
isFullScreen | Public method to check, if full screen mode is active.
isLoading | Public method to get the loading state.
load | Public method to load a web site.
loadFromSessionData | Public method to load the session data.
mainWindow | Public method to get a reference to the main window.
mapToViewport | Public method to map a position to the viewport.
paste | Public slot to paste text from the clipboard.
preferencesChanged | Public method to indicate a change of the settings.
progress | Public method to get the load progress.
redo | Public slot to redo the last edit action.
reload | Public slot to reload the current page.
reloadBypassingCache | Public slot to reload the current page bypassing the cache.
requestFullScreen | Public method to request full screen mode.
saveAs | Public method to save the current page to a file.
selectAll | Public slot to select all text.
setSource | Public method used to set the source to be displayed.
setZoomValue | Public method to set the zoom value.
showEvent | Protected method to handle show events.
source | Public method to return the URL of the loaded page.
storeSessionData | Public method to store session data to be restored later on.
undo | Public slot to undo the last edit action.
unselect | Public slot to clear the current selection.
zoomIn | Public slot to zoom into the page.
zoomOut | Public slot to zoom out of the page.
zoomReset | Public method to reset the zoom factor.
zoomValue | Public method to get the current zoom value.

### Static Methods

None

#### WebBrowserView (Constructor)

WebBrowserView(mainWindow, parent=None, name="")

Constructor

mainWindow
  reference to the main window (WebBrowserWindow)
parent
  parent widget of this window (QWidget)
name
  name of this window (string)

#### WebBrowserView.__addBookmarkCallback

__addBookmarkCallback(res)

Private callback method of __addBookmark().

res (list)
  reference to the result list containing all meta attributes

#### WebBrowserView.__addSearchEngine

__addSearchEngine()

Private slot to add a new search engine.

#### WebBrowserView.__addSpeedDial

__addSpeedDial()

Private slot to add a new speed dial.

#### WebBrowserView.__adjustBookmark

__adjustBookmark(lastModified)

Private slot to adjust the 'lastModified' value of bookmarks.

lastModified (str)
  last modified value

#### WebBrowserView.__blockImage

__blockImage()

Private slot to add a block rule for an image URL.

#### WebBrowserView.__bookmarkLink

__bookmarkLink()

Private slot to bookmark a link via the context menu.

#### WebBrowserView.__checkForForm

__checkForForm(act, pos)

Private method to check the given position for an open search form.

act (QAction)
  reference to the action to be populated upon success
pos (QPoint)
  position to be tested

#### WebBrowserView.__checkForFormCallback

__checkForFormCallback(res, act)

Private method handling the __checkForForm result.

res (dict)
  result dictionary generated by JavaScript
act (QAction)
  reference to the action to be populated upon success

#### WebBrowserView.__configureSpeedDial

__configureSpeedDial()

Private slot to configure the speed dial.

#### WebBrowserView.__copyImage

__copyImage()

Private slot to copy an image to the clipboard.

#### WebBrowserView.__copyLink

__copyLink()

Private slot to copy a link to the clipboard.

#### WebBrowserView.__createContextMenu

__createContextMenu(menu, hitTest)

Private method to populate the context menu.

menu (QMenu)
  reference to the menu to be populated
hitTest (WebHitTestResult)
  reference to the hit test object

#### WebBrowserView.__createImageContextMenu

__createImageContextMenu(menu, hitTest)

Private method to populate the context menu for images.

menu (QMenu)
  reference to the menu to be populated
hitTest (WebHitTestResult)
  reference to the hit test object

#### WebBrowserView.__createLinkContextMenu

__createLinkContextMenu(menu, hitTest)

Private method to populate the context menu for URLs.

menu (QMenu)
  reference to the menu to be populated
hitTest (WebHitTestResult)
  reference to the hit test object

#### WebBrowserView.__createMediaContextMenu

__createMediaContextMenu(menu, hitTest)

Private method to populate the context menu for media elements.

menu (QMenu)
  reference to the menu to be populated
hitTest (WebHitTestResult)
  reference to the hit test object

#### WebBrowserView.__createNewPage

__createNewPage()

Private method to create a new page object.

#### WebBrowserView.__createPageContextMenu

__createPageContextMenu(menu)

Private method to populate the basic context menu.

menu (QMenu)
  reference to the menu to be populated

#### WebBrowserView.__createSelectedTextContextMenu

__createSelectedTextContextMenu(menu, hitTest)

Private method to populate the context menu for selected text.

menu (QMenu)
  reference to the menu to be populated
hitTest (WebHitTestResult)
  reference to the hit test object

#### WebBrowserView.__currentEngineChanged

__currentEngineChanged()

Private slot to track a change of the current search engine.

#### WebBrowserView.__downloadImage

__downloadImage()

Private slot to download an image and save it to disk.

#### WebBrowserView.__downloadLink

__downloadLink()

Private slot to download a link and save it to disk.

#### WebBrowserView.__downloadMedia

__downloadMedia()

Private slot to download a media and save it to disk.

#### WebBrowserView.__getSavePageFileNameAndFormat

__getSavePageFileNameAndFormat()

Private method to get the file name to save the page to.

Returns:
  tuple containing the file name to save to and the save page format

Return Type:
  tuple of (str, QWebEngineDownloadItem.SavePageFormat)

#### WebBrowserView.__iconLoaded

__iconLoaded(icon)

Private slot handling the loaded web site icon.

icon (QIcon)
  web site icon

#### WebBrowserView.__iconUrlChanged

__iconUrlChanged(url)

Private slot to handle the iconUrlChanged signal.

url (QUrl)
  URL to get web site icon from

#### WebBrowserView.__isUrlValid

__isUrlValid(url)

Private method to check a URL for validity.

url
  URL to be checked (QUrl)

Returns:
  flag indicating a valid URL (boolean)

#### WebBrowserView.__levelForZoom

__levelForZoom(zoom)

Private method determining the zoom level index given a zoom factor.

zoom
  zoom factor (integer)

Returns:
  index of zoom factor (integer)

#### WebBrowserView.__linkHovered

__linkHovered(link)

Private slot to handle the linkHovered signal.

link
  the URL of the link (string)

#### WebBrowserView.__loadFinished

__loadFinished(ok)

Private method to handle the loadFinished signal.

ok
  flag indicating the result (boolean)

#### WebBrowserView.__loadProgress

__loadProgress(progress)

Private method to handle the loadProgress signal.

progress
  progress value (integer)

#### WebBrowserView.__loadStarted

__loadStarted()

Private method to handle the loadStarted signal.

#### WebBrowserView.__muteMedia

__muteMedia()

Private slot to (un)mute the selected media.

#### WebBrowserView.__openLinkInNewPrivateWindow

__openLinkInNewPrivateWindow()

Private slot called by the context menu to open a link in a new private window.

#### WebBrowserView.__openLinkInNewTab

__openLinkInNewTab()

Private method called by the context menu to open a link in a new tab.

#### WebBrowserView.__openLinkInNewWindow

__openLinkInNewWindow()

Private slot called by the context menu to open a link in a new window.

#### WebBrowserView.__pauseMedia

__pauseMedia()

Private slot to pause or play the selected media.

#### WebBrowserView.__reloadAllSpeedDials

__reloadAllSpeedDials()

Private slot to reload all speed dials.

#### WebBrowserView.__renderPreview

__renderPreview()

Private slot to render a preview pixmap after the page was loaded.

#### WebBrowserView.__renderProcessTerminated

__renderProcessTerminated(status, exitCode)

Private slot handling a crash of the web page render process.

status (QWebEnginePage.RenderProcessTerminationStatus)
  termination status
exitCode (int)
  exit code of the process

#### WebBrowserView.__replaceMisspelledWord

__replaceMisspelledWord()

Private slot to replace a misspelled word under the context menu.

#### WebBrowserView.__resetSpeedDials

__resetSpeedDials()

Private slot to reset all speed dials to the default pages.

#### WebBrowserView.__searchDefaultRequested

__searchDefaultRequested()

Private slot to search for some text with the current search engine.

#### WebBrowserView.__searchImage

__searchImage()

Private slot to search for an image URL.

#### WebBrowserView.__searchRequested

__searchRequested(act)

Private slot to search for some text with a selected search engine.

act
  reference to the action that triggered this slot (QAction)

#### WebBrowserView.__sendLink

__sendLink()

Private slot to send a link via email.

#### WebBrowserView.__setRwhvqt

__setRwhvqt()

Private slot to set widget that receives input events.

#### WebBrowserView.__showEventSlot

__showEventSlot()

Private slot to perform actions when the view is shown and the event loop is running.

#### WebBrowserView.__showTabCrashPage

__showTabCrashPage(status)

Private slot to show the tab crash page.

status (QWebEnginePage.RenderProcessTerminationStatus)
  termination status

#### WebBrowserView.__urlChanged

__urlChanged(url)

Private slot to handle the urlChanged signal.

url
  the new url (QUrl)

#### WebBrowserView.__virusTotal

__virusTotal()

Private slot to scan the selected URL with VirusTotal.

#### WebBrowserView.__webInspector

__webInspector()

Private slot to show the web inspector window.

#### WebBrowserView._contextMenuEvent

_contextMenuEvent(evt)

Protected method called to create a context menu.

This method is overridden from QWebEngineView.

evt
  reference to the context menu event object (QContextMenuEvent)

#### WebBrowserView._gestureEvent

_gestureEvent(evt)

Protected method handling gesture events.

evt
  reference to the gesture event (QGestureEvent

#### WebBrowserView._keyPressEvent

_keyPressEvent(evt)

Protected method called by a key press.

evt
  reference to the key event (QKeyEvent)

#### WebBrowserView._keyReleaseEvent

_keyReleaseEvent(evt)

Protected method called by a key release.

evt
  reference to the key event (QKeyEvent)

#### WebBrowserView._mouseMoveEvent

_mouseMoveEvent(evt)

Protected method to handle mouse move events.

evt
  reference to the mouse event (QMouseEvent)

#### WebBrowserView._mousePressEvent

_mousePressEvent(evt)

Protected method called by a mouse press event.

evt
  reference to the mouse event (QMouseEvent)

#### WebBrowserView._mouseReleaseEvent

_mouseReleaseEvent(evt)

Protected method called by a mouse release event.

evt
  reference to the mouse event (QMouseEvent)

#### WebBrowserView._wheelEvent

_wheelEvent(evt)

Protected method to handle wheel events.

evt
  reference to the wheel event (QWheelEvent)

#### WebBrowserView.activateSession

activateSession()

Public slot to activate a restored session.

#### WebBrowserView.addBookmark

addBookmark()

Public slot to bookmark the current page.

#### WebBrowserView.backward

backward()

Public slot to move backwards in history.

#### WebBrowserView.checkRSS

checkRSS()

Public method to check, if the loaded page contains feed links.

Returns:
  flag indicating the existence of feed links (boolean)

#### WebBrowserView.clearHistory

clearHistory()

Public slot to clear the history.

#### WebBrowserView.closeWebInspector

closeWebInspector()

Public slot to close the web inspector.

#### WebBrowserView.contextMenuEvent

contextMenuEvent(evt)

Protected method called to create a context menu.

This method is overridden from QWebEngineView.

evt
  reference to the context menu event object (QContextMenuEvent)

#### WebBrowserView.copy

copy()

Public slot to copy the selected text.

#### WebBrowserView.createWindow

createWindow(windowType)

Public method called, when a new window should be created.

windowType
  type of the requested window (QWebEnginePage.WebWindowType)

Returns:
  reference to the created browser window (WebBrowserView)

#### WebBrowserView.cut

cut()

Public slot to cut the selected text.

#### WebBrowserView.documentTitle

documentTitle()

Public method to return the title of the loaded page.

Returns:
  title (string)

#### WebBrowserView.dragEnterEvent

dragEnterEvent(evt)

Protected method called by a drag enter event.

evt
  reference to the drag enter event (QDragEnterEvent)

#### WebBrowserView.dragMoveEvent

dragMoveEvent(evt)

Protected method called by a drag move event.

evt
  reference to the drag move event (QDragMoveEvent)

#### WebBrowserView.dropEvent

dropEvent(evt)

Protected method called by a drop event.

evt
  reference to the drop event (QDropEvent)

#### WebBrowserView.event

event(evt)

Public method handling events.

evt
  reference to the event (QEvent)

Returns:
  flag indicating, if the event was handled (boolean)

#### WebBrowserView.eventFilter

eventFilter(obj, evt)

Public method to process event for other objects.

obj (QObject)
  reference to object to process events for
evt (QEvent)
  reference to event to be processed

Returns:
  flag indicating that the event should be filtered out

Return Type:
  bool

#### WebBrowserView.extractSessionMetaData

extractSessionMetaData(sessionData)

Public method to extract some session meta data elements needed by the tab widget in case of deferred loading.

sessionData (dict)
  dictionary containing the session data as generated by getSessionData()

Returns:
  tuple containing the title, URL and web icon

Return Type:
  tuple of (str, str, QIcon)

#### WebBrowserView.findNextPrev

findNextPrev(txt, case, backwards, callback)

Public slot to find the next occurrence of a text.

txt
  text to search for (string)
case
  flag indicating a case sensitive search (boolean)
backwards
  flag indicating a backwards search (boolean)
callback (function(bool) or None)
  reference to a function with a bool parameter

#### WebBrowserView.forward

forward()

Public slot to move forward in history.

#### WebBrowserView.getPreview

getPreview()

Public method to get the preview pixmap.

Returns:
  preview pixmap

Return Type:
  QPixmap

#### WebBrowserView.getRSS

getRSS()

Public method to get the extracted RSS feeds.

Returns:
  list of RSS feeds (list of tuples of two strings)

#### WebBrowserView.getSafeBrowsingStatus

getSafeBrowsingStatus()

Public method to get the safe browsing status of the current page.

Returns:
  flag indicating a safe site

Return Type:
  bool

#### WebBrowserView.getSessionData

getSessionData()

Public method to populate the session data.

Returns:
  dictionary containing the session data

Return Type:
  dict

#### WebBrowserView.hasRSS

hasRSS()

Public method to check, if the loaded page has RSS links.

Returns:
  flag indicating the presence of RSS links (boolean)

#### WebBrowserView.hasSelection

hasSelection()

Public method to determine, if there is some text selected.

Returns:
  flag indicating text has been selected (boolean)

#### WebBrowserView.home

home()

Public slot to move to the first page loaded.

#### WebBrowserView.icon

icon()

Public method to get the web site icon.

Returns:
  web site icon

Return Type:
  QIcon

#### WebBrowserView.inputWidget

inputWidget()

Public method to get a reference to the render widget.

Returns:
  reference to the render widget

Return Type:
  QWidget

#### WebBrowserView.isBackwardAvailable

isBackwardAvailable()

Public method to determine, if a backwards move in history is possible.

Returns:
  flag indicating move backwards is possible (boolean)

#### WebBrowserView.isForwardAvailable

isForwardAvailable()

Public method to determine, if a forward move in history is possible.

Returns:
  flag indicating move forward is possible (boolean)

#### WebBrowserView.isFullScreen

isFullScreen()

Public method to check, if full screen mode is active.

Returns:
  flag indicating full screen mode

Return Type:
  bool

#### WebBrowserView.isLoading

isLoading()

Public method to get the loading state.

Returns:
  flag indicating the loading state (boolean)

#### WebBrowserView.load

load(url)

Public method to load a web site.

url (QUrl)
  URL to be loaded

#### WebBrowserView.loadFromSessionData

loadFromSessionData(sessionData)

Public method to load the session data.

sessionData (dict)
  dictionary containing the session data as generated by getSessionData()

#### WebBrowserView.mainWindow

mainWindow()

Public method to get a reference to the main window.

Returns:
  reference to the main window

Return Type:
  WebBrowserWindow

#### WebBrowserView.mapToViewport

mapToViewport(pos)

Public method to map a position to the viewport.

pos (QPoint)
  position to be mapped

Returns:
  viewport position

Return Type:
  QPoint

#### WebBrowserView.paste

paste()

Public slot to paste text from the clipboard.

#### WebBrowserView.preferencesChanged

preferencesChanged()

Public method to indicate a change of the settings.

#### WebBrowserView.progress

progress()

Public method to get the load progress.

Returns:
  load progress (integer)

#### WebBrowserView.redo

redo()

Public slot to redo the last edit action.

#### WebBrowserView.reload

reload()

Public slot to reload the current page.

#### WebBrowserView.reloadBypassingCache

reloadBypassingCache()

Public slot to reload the current page bypassing the cache.

#### WebBrowserView.requestFullScreen

requestFullScreen(enable)

Public method to request full screen mode.

enable (bool)
  flag indicating full screen mode on or off

#### WebBrowserView.saveAs

saveAs()

Public method to save the current page to a file.

#### WebBrowserView.selectAll

selectAll()

Public slot to select all text.

#### WebBrowserView.setSource

setSource(name, newTab=False)

Public method used to set the source to be displayed.

name
  filename to be shown (QUrl)
newTab
  flag indicating to open the URL in a new tab (bool)

#### WebBrowserView.setZoomValue

setZoomValue(value, saveValue=True)

Public method to set the zoom value.

value
  zoom value (integer)
saveValue= (bool)
  flag indicating to save the zoom value with the zoom manager

#### WebBrowserView.showEvent

showEvent(evt)

Protected method to handle show events.

evt (QShowEvent)
  reference to the show event object

#### WebBrowserView.source

source()

Public method to return the URL of the loaded page.

Returns:
  URL loaded in the help browser (QUrl)

#### WebBrowserView.storeSessionData

storeSessionData(data)

Public method to store session data to be restored later on.

data (dict)
  dictionary with session data to be restored

#### WebBrowserView.undo

undo()

Public slot to undo the last edit action.

#### WebBrowserView.unselect

unselect()

Public slot to clear the current selection.

#### WebBrowserView.zoomIn

zoomIn()

Public slot to zoom into the page.

#### WebBrowserView.zoomOut

zoomOut()

Public slot to zoom out of the page.

#### WebBrowserView.zoomReset

zoomReset()

Public method to reset the zoom factor.

#### WebBrowserView.zoomValue

zoomValue()

Public method to get the current zoom value.

Returns:
  zoom value (integer)

Up