QWebPage Class Reference

#include <mw/QtWebKit/qwebpage.h>

class QWebPage : public QObject, public QObject

The QWebPage class provides an object to view and edit web documents.

Inherits from

  • QWebPage
    Public Member Enumerations
    enumErrorDomain { QtNetwork, Http, WebKit }
    enumExtension { ChooseMultipleFilesExtension, ErrorPageExtension }
    enumFeature { Notifications, Geolocation }
    enumFindFlag { FindBackward, FindCaseSensitively, FindWrapsAroundDocument, HighlightAllOccurrences }
    enumPermissionPolicy { PermissionUnknown, PermissionGrantedByUser, PermissionDeniedByUser }
    enumWebAction { NoWebAction, OpenLink, OpenLinkInNewWindow, OpenFrameInNewWindow, ..., WebActionCount }
    enumWebWindowType { WebBrowserWindow, WebModalDialog }
    Public Properties
    boolcontentEditable
    boolforwardUnsupportedContent
    LinkDelegationPolicylinkDelegationPolicy
    boolmodified
    QPalette palette
    QSizepreferredContentsSize
    QString selectedText
    QSizeviewportSize
    Public Member Functions
    QWebPage(QObject *)
    ~QWebPage()
    Q_DECLARE_FLAGS(FindFlags, FindFlag)
    Q_ENUMS(LinkDelegationPolicy NavigationType)
    QAction *action(WebAction)
    quint64 bytesReceived()
    QMenu *createStandardContextMenu()
    QWebFrame *currentFrame()
    virtual boolevent(QEvent *)
    virtual boolextension(Extension, const ExtensionOption *, ExtensionReturn *)
    boolfindText(const QString &, FindFlags)
    boolfocusNextPrevChild(bool)
    boolforwardUnsupportedContent()
    QWebFrame *frameAt(const QPoint &)
    QWebPagePrivate *handle()
    QWebHistory *history()
    QVariant inputMethodQuery(Qt::InputMethodQuery)
    boolisContentEditable()
    boolisModified()
    LinkDelegationPolicylinkDelegationPolicy()
    QWebFrame *mainFrame()
    QNetworkAccessManager *networkAccessManager()
    QPalette palette()
    QWebPluginFactory *pluginFactory()
    QSizepreferredContentsSize()
    intqWebKitMajorVersion()
    intqWebKitMinorVersion()
    QString qWebKitVersion()
    QString selectedText()
    voidsetActualVisibleContentRect(const QRect &)
    voidsetContentEditable(bool)
    voidsetFeaturePermission(QWebFrame *, Feature, PermissionPolicy)
    voidsetForwardUnsupportedContent(bool)
    voidsetLinkDelegationPolicy(LinkDelegationPolicy)
    voidsetNetworkAccessManager(QNetworkAccessManager *)
    voidsetPalette(const QPalette &)
    voidsetPluginFactory(QWebPluginFactory *)
    voidsetPreferredContentsSize(const QSize &)
    voidsetView(QWidget *)
    voidsetViewportSize(const QSize &)
    QWebSettings *settings()
    virtual boolsupportsExtension(Extension)
    boolswallowContextMenuEvent(QContextMenuEvent *)
    quint64 totalBytes()
    virtual voidtriggerAction(WebAction, bool)
    QUndoStack *undoStack()
    voidupdatePositionDependentActions(const QPoint &)
    QWidget *view()
    ViewportAttributes viewportAttributesForSize(const QSize &)
    QSizeviewportSize()
    Protected Member Functions
    virtual boolacceptNavigationRequest(QWebFrame *, const QNetworkRequest &, NavigationType)
    virtual QString chooseFile(QWebFrame *, const QString &)
    virtual QObject *createPlugin(const QString &, const QUrl &, const QStringList &, const QStringList &)
    virtual QWebPage *createWindow(WebWindowType)
    virtual voidjavaScriptAlert(QWebFrame *, const QString &)
    virtual booljavaScriptConfirm(QWebFrame *, const QString &)
    virtual voidjavaScriptConsoleMessage(const QString &, int, const QString &)
    virtual booljavaScriptPrompt(QWebFrame *, const QString &, const QString &, QString *)
    virtual QString userAgentForUrl(const QUrl &)
    Public Slots
    boolshouldInterruptJavaScript()
    Public Signals
    voidcontentsChanged()
    voiddatabaseQuotaExceeded(QWebFrame *, QString)
    voiddownloadRequested(const QNetworkRequest &)
    voidfeaturePermissionRequestCanceled(QWebFrame *, QWebPage::Feature)
    voidfeaturePermissionRequested(QWebFrame *, QWebPage::Feature)
    voidframeCreated(QWebFrame *)
    voidgeometryChangeRequested(const QRect &)
    voidlinkClicked(const QUrl &)
    voidlinkHovered(const QString &, const QString &, const QString &)
    voidloadFinished(bool)
    voidloadProgress(int)
    voidloadStarted()
    voidmenuBarVisibilityChangeRequested(bool)
    voidmicroFocusChanged()
    voidprintRequested(QWebFrame *)
    voidrepaintRequested(const QRect &)
    voidrestoreFrameStateRequested(QWebFrame *)
    voidsaveFrameStateRequested(QWebFrame *, QWebHistoryItem *)
    voidscrollRequested(int, int, const QRect &)
    voidselectionChanged()
    voidstatusBarMessage(const QString &)
    voidstatusBarVisibilityChangeRequested(bool)
    voidtoolBarVisibilityChangeRequested(bool)
    voidunsupportedContent(QNetworkReply *)
    voidviewportChangeRequested()
    voidwindowCloseRequested()
    Inherited Attributes
    QObject::d_ptr
    QObject::objectName
    QObject::staticQtMetaObject
    Inherited Functions
    QObject::QObject(QObjectPrivate &,QObject *)
    QObject::blockSignals(bool)
    QObject::childEvent(QChildEvent *)
    QObject::children()const
    QObject::connect(const QObject *,const QMetaMethod &,const QObject *,const QMetaMethod &,Qt::ConnectionType)
    QObject::connect(const QObject *,const char *,const QObject *,const char *,Qt::ConnectionType)
    QObject::connect(const QObject *,const char *,const char *,Qt::ConnectionType)const
    QObject::connectNotify(const char *)
    QObject::customEvent(QEvent *)
    QObject::deleteLater
    QObject::destroyed
    QObject::disconnect(const QObject *,const QMetaMethod &,const QObject *,const QMetaMethod &)
    QObject::disconnect(const QObject *,const char *)
    QObject::disconnect(const QObject *,const char *,const QObject *,const char *)
    QObject::disconnect(const char *,const QObject *,const char *)
    QObject::disconnectNotify(const char *)
    QObject::dumpObjectInfo()
    QObject::dumpObjectTree()
    QObject::dynamicPropertyNames()const
    QObject::eventFilter(QObject *,QEvent *)
    QObject::findChild(const QString &)const
    QObject::findChildren(const QRegExp &)const
    QObject::findChildren(const QString &)const
    QObject::inherits(const char *)const
    QObject::installEventFilter(QObject *)
    QObject::isWidgetType()const
    QObject::killTimer(int)
    QObject::moveToThread(QThread *)
    QObject::objectName()const
    QObject::parent()const
    QObject::property(const char *)const
    QObject::receivers(const char *)const
    QObject::registerUserData()
    QObject::removeEventFilter(QObject *)
    QObject::sender()const
    QObject::senderSignalIndex()const
    QObject::setObjectName(const QString &)
    QObject::setParent(QObject *)
    QObject::setProperty(const char *,const QVariant &)
    QObject::setUserData(uint,QObjectUserData *)
    QObject::signalsBlocked()const
    QObject::startTimer(int)
    QObject::thread()const
    QObject::timerEvent(QTimerEvent *)
    QObject::userData(uint)const
    QObject::~QObject()

    Detailed Description

    Since
    4.4 QtWebKit
    QWebPage holds a main frame responsible for web content, settings, the history of navigated links and actions. This class can be used, together with QWebFrame, to provide functionality like QWebView in a widget-less environment.

    QWebPage's API is very similar to QWebView, as you are still provided with common functions like action() (known as {QWebView::pageAction()}{pageAction}() in QWebView), triggerAction(), findText() and settings(). More QWebView-like functions can be found in the main frame of QWebPage, obtained via the mainFrame() function. For example, the {QWebFrame::load()}{load}(), {QWebFrame::setUrl()}{setUrl}() and {QWebFrame::setHtml()}{setHtml}() functions for QWebPage can be accessed using QWebFrame.

    The loadStarted() signal is emitted when the page begins to load.The loadProgress() signal, on the other hand, is emitted whenever an element of the web page completes loading, such as an embedded image, a script, etc. Finally, the loadFinished() signal is emitted when the page contents are loaded completely, independent of script execution or page rendering. Its argument, either true or false, indicates whether or not the load operation succeeded.

    Member Enumeration Documentation

    Enum ErrorDomain

    Since
    4.6
    This enum describes the domain of an ErrorPageExtensionOption object (i.e. the layer in which the error occurred).

    QtNetwork The error occurred in the QtNetwork layer; the error code is of type QNetworkReply::NetworkError. Http The error occurred in the HTTP layer; the error code is a HTTP status code (see QNetworkRequest::HttpStatusCodeAttribute). WebKit The error is an internal WebKit error.

    EnumeratorValueDescription
    QtNetwork
    Http
    WebKit

    Enum Extension

    This enum describes the types of extensions that the page can support. Before using these extensions, you should verify that the extension is supported by calling supportsExtension().

    ChooseMultipleFilesExtension Whether the web page supports multiple file selection. This extension is invoked when the web content requests one or more file names, for example as a result of the user clicking on a "file upload" button in a HTML form where multiple file selection is allowed.

    ErrorPageExtension Whether the web page can provide an error page when loading fails. (introduced in Qt 4.6)

    See also: ChooseMultipleFilesExtensionOption, ChooseMultipleFilesExtensionReturn, ErrorPageExtensionOption, ErrorPageExtensionReturn

    Enum Feature

    EnumeratorValueDescription
    Notifications
    Geolocation

    Enum FindFlag

    This enum describes the options available to the findText() function. The options can be OR-ed together from the following list:

    FindBackward Searches backwards instead of forwards. FindCaseSensitively By default findText() works case insensitive. Specifying this option changes the behaviour to a case sensitive find operation. FindWrapsAroundDocument Makes findText() restart from the beginning of the document if the end was reached and the text was not found. HighlightAllOccurrences Highlights all existing occurrences of a specific string.

    Enum PermissionPolicy

    Enum WebAction

    This enum describes the types of action which can be performed on the web page.

    Actions only have an effect when they are applicable. The availability of actions can be be determined by checking {QAction::}{isEnabled()} on the action returned by action().

    One method of enabling the text editing, cursor movement, and text selection actions is by setting contentEditable to true.

    NoWebAction No action is triggered. OpenLink Open the current link. OpenLinkInNewWindow Open the current link in a new window. OpenFrameInNewWindow Replicate the current frame in a new window. DownloadLinkToDisk Download the current link to the disk. CopyLinkToClipboard Copy the current link to the clipboard. OpenImageInNewWindow Open the highlighted image in a new window. DownloadImageToDisk Download the highlighted image to the disk. CopyImageToClipboard Copy the highlighted image to the clipboard. Back Navigate back in the history of navigated links. Forward Navigate forward in the history of navigated links. Stop Stop loading the current page. StopScheduledPageRefresh Stop all pending page refresh/redirect requests. Reload Reload the current page. ReloadAndBypassCache Reload the current page, but do not use any local cache. (Added in Qt 4.6) Cut Cut the content currently selected into the clipboard. Copy Copy the content currently selected into the clipboard. Paste Paste content from the clipboard. Undo Undo the last editing action. Redo Redo the last editing action. MoveToNextChar Move the cursor to the next character. MoveToPreviousChar Move the cursor to the previous character. MoveToNextWord Move the cursor to the next word. MoveToPreviousWord Move the cursor to the previous word. MoveToNextLine Move the cursor to the next line. MoveToPreviousLine Move the cursor to the previous line. MoveToStartOfLine Move the cursor to the start of the line. MoveToEndOfLine Move the cursor to the end of the line. MoveToStartOfBlock Move the cursor to the start of the block. MoveToEndOfBlock Move the cursor to the end of the block. MoveToStartOfDocument Move the cursor to the start of the document. MoveToEndOfDocument Move the cursor to the end of the document. SelectNextChar Select to the next character. SelectPreviousChar Select to the previous character. SelectNextWord Select to the next word. SelectPreviousWord Select to the previous word. SelectNextLine Select to the next line. SelectPreviousLine Select to the previous line. SelectStartOfLine Select to the start of the line. SelectEndOfLine Select to the end of the line. SelectStartOfBlock Select to the start of the block. SelectEndOfBlock Select to the end of the block. SelectStartOfDocument Select to the start of the document. SelectEndOfDocument Select to the end of the document. DeleteStartOfWord Delete to the start of the word. DeleteEndOfWord Delete to the end of the word. SetTextDirectionDefault Set the text direction to the default direction. SetTextDirectionLeftToRight Set the text direction to left-to-right. SetTextDirectionRightToLeft Set the text direction to right-to-left. ToggleBold Toggle the formatting between bold and normal weight. ToggleItalic Toggle the formatting between italic and normal style. ToggleUnderline Toggle underlining. InspectElement Show the Web Inspector with the currently highlighted HTML element. InsertParagraphSeparator Insert a new paragraph. InsertLineSeparator Insert a new line. SelectAll Selects all content. PasteAndMatchStyle Paste content from the clipboard with current style. RemoveFormat Removes formatting and style. ToggleStrikethrough Toggle the formatting between strikethrough and normal style. ToggleSubscript Toggle the formatting between subscript and baseline. ToggleSuperscript Toggle the formatting between supercript and baseline. InsertUnorderedList Toggles the selection between an ordered list and a normal block. InsertOrderedList Toggles the selection between an ordered list and a normal block. Indent Increases the indentation of the currently selected format block by one increment. Outdent Decreases the indentation of the currently selected format block by one increment. AlignCenter Applies center alignment to content. AlignJustified Applies full justification to content. AlignLeft Applies left justification to content. AlignRight Applies right justification to content.

    WebActionCount

    Enum WebWindowType

    This enum describes the types of window that can be created by the createWindow() function.

    WebBrowserWindow The window is a regular web browser window. WebModalDialog The window acts as modal dialog.

    EnumeratorValueDescription
    WebBrowserWindow
    WebModalDialog

    Properties Documentation

    contentEditable

    boolcontentEditable

    whether the content in this QWebPage is editable or not

    Since
    4.5
    If this property is enabled the contents of the page can be edited by the user through a visible cursor. If disabled (the default) only HTML elements in the web page with their {contenteditable} attribute set are editable.

    See also: modified, contentsChanged(), WebAction

    forwardUnsupportedContent

    boolforwardUnsupportedContent

    whether QWebPage should forward unsupported content

    If enabled, the unsupportedContent() signal is emitted with a network reply that can be used to read the content.

    If disabled, the download of such content is aborted immediately.

    By default unsupported content is not forwarded.

    linkDelegationPolicy

    LinkDelegationPolicylinkDelegationPolicy

    how QWebPage should delegate the handling of links through the linkClicked() signal

    The default is to delegate no links.

    modified

    boolmodified

    whether the page contains unsubmitted form data, or the contents have been changed.

    By default, this property is false.

    See also: contentsChanged(), contentEditable, undoStack()

    palette

    QPalette palette

    the page's palette

    The base brush of the palette is used to draw the background of the main frame.

    By default, this property contains the application's default palette.

    preferredContentsSize

    QSizepreferredContentsSize

    a custom size used for laying out the page contents.

    Since
    4.6 By default all pages are laid out using the viewport of the page as the base.
    As pages mostly are designed for desktop usage, they often do not layout properly on small devices as the contents require a certain view width. For this reason it is common to use a different layout size and then scale the contents to fit within the actual view.

    If this property is set to a valid size, this size is used for all layout needs instead of the size of the viewport.

    Setting an invalid size, makes the page fall back to using the viewport size for layout.

    See also: viewportSize

    selectedText

    QString selectedText

    the text currently selected

    By default, this property contains an empty string.

    See also: selectionChanged()

    viewportSize

    QSizeviewportSize

    the size of the viewport

    The size affects for example the visibility of scrollbars if the document is larger than the viewport.

    By default, for a newly-created Web page, this property contains a size with zero width and height.

    See also: QWebFrame::render(), preferredContentsSize

    Constructor & Destructor Documentation

    QWebPage ( QObject * )

    QWebPage(QObject *parent = 0)[explicit]

    Constructs an empty QWebPage with parent parent.

    ~QWebPage ( )

    ~QWebPage()

    Destroys the web page.

    Member Function Documentation

    Q_DECLARE_FLAGS ( FindFlags, FindFlag )

    Q_DECLARE_FLAGS(FindFlags,
    FindFlag
    )[inline]

    Q_ENUMS ( LinkDelegationPolicy NavigationType )

    Q_ENUMS(LinkDelegationPolicy NavigationTypeWebAction)[inline]

    acceptNavigationRequest ( QWebFrame *, const QNetworkRequest &, NavigationType )

    boolacceptNavigationRequest(QWebFrame *frame,
    const QNetworkRequest &request,
    NavigationTypetype
    )[protected, virtual]

    action ( WebAction )

    QAction *action(WebActionaction)const

    Returns a QAction for the specified WebAction action.

    The action is owned by the QWebPage but you can customize the look by changing its properties.

    QWebPage also takes care of implementing the action, so that upon triggering the corresponding action is performed on the page.

    See also: triggerAction()

    bytesReceived ( )

    quint64 bytesReceived()const

    Returns the number of bytes that were received from the network to render the current page.

    See also: totalBytes(), loadProgress()

    chooseFile ( QWebFrame *, const QString & )

    QString chooseFile(QWebFrame *originatingFrame,
    const QString &oldFile
    )[protected, virtual]

    This function is called when the web content requests a file name, for example as a result of the user clicking on a "file upload" button in a HTML form.

    A suggested filename may be provided in suggestedFile. The frame originating the request is provided as parentFrame.

    See also: ChooseMultipleFilesExtension

    contentsChanged ( )

    voidcontentsChanged()[signal]
    Since
    4.5
    This signal is emitted whenever the text in form elements changes as well as other editable content.

    See also: contentEditable, modified, QWebFrame::toHtml(), QWebFrame::toPlainText()

    createPlugin ( const QString &, const QUrl &, const QStringList &, const QStringList & )

    QObject *createPlugin(const QString &classid,
    const QUrl &url,
    const QStringList &paramNames,
    const QStringList &paramValues
    )[protected, virtual]

    This function is called whenever WebKit encounters a HTML object element with type "application/x-qt-plugin". It is called regardless of the value of QWebSettings::PluginsEnabled. The classid, url, paramNames and paramValues correspond to the HTML object element attributes and child elements to configure the embeddable object.

    createStandardContextMenu ( )

    QMenu *createStandardContextMenu()
    Since
    4.5 This function creates the standard context menu which is shown when the user clicks on the web page with the right mouse button. It is called from the default contextMenuEvent() handler. The popup menu's ownership is transferred to the caller.

    createWindow ( WebWindowType )

    QWebPage *createWindow(WebWindowTypetype)[protected, virtual]

    This function is called whenever WebKit wants to create a new window of the given type, for example when a JavaScript program requests to open a document in a new window.

    If the new window can be created, the new window's QWebPage is returned; otherwise a null pointer is returned.

    If the view associated with the web page is a QWebView object, then the default implementation forwards the request to QWebView's createWindow() function; otherwise it returns a null pointer.

    If type is WebModalDialog, the application must call setWindowModality(Qt::ApplicationModal) on the new window.

    Note:

    In the cases when the window creation is being triggered by JavaScript, apart from reimplementing this method application must also set the JavaScriptCanOpenWindows attribute of QWebSettings to true in order for it to get called.

    See also: acceptNavigationRequest(), QWebView::createWindow()

    currentFrame ( )

    QWebFrame *currentFrame()const

    Returns the frame currently active.

    See also: mainFrame(), frameCreated()

    databaseQuotaExceeded ( QWebFrame *, QString )

    voiddatabaseQuotaExceeded(QWebFrame *frame,
    QStringdatabaseName
    )[signal]
    Since
    4.5
    This signal is emitted whenever the web site shown in frame is asking to store data to the database databaseName and the quota allocated to that web site is exceeded.

    See also: QWebDatabase

    downloadRequested ( const QNetworkRequest & )

    voiddownloadRequested(const QNetworkRequest &request)[signal]

    This signal is emitted when the user decides to download a link. The url of the link as well as additional meta-information is contained in request.

    See also: unsupportedContent()

    event ( QEvent * )

    boolevent(QEvent *)[virtual]

    Reimplemented from QObject::event(QEvent *)

    extension ( Extension, const ExtensionOption *, ExtensionReturn * )

    boolextension(Extensionextension,
    const ExtensionOption *option = 0,
    ExtensionReturn *output = 0
    )[virtual]

    This virtual function can be reimplemented in a QWebPage subclass to provide support for extensions. The option argument is provided as input to the extension; the output results can be stored in output.

    The behavior of this function is determined by extension. The option and output values are typically casted to the corresponding types (for example, ChooseMultipleFilesExtensionOption and ChooseMultipleFilesExtensionReturn for ChooseMultipleFilesExtension).

    You can call supportsExtension() to check if an extension is supported by the page.

    Returns true if the extension was called successfully; otherwise returns false.

    See also: supportsExtension(), Extension

    featurePermissionRequestCanceled ( QWebFrame *, QWebPage::Feature )

    voidfeaturePermissionRequestCanceled(QWebFrame *frame,
    QWebPage::Featurefeature
    )[signal]

    featurePermissionRequested ( QWebFrame *, QWebPage::Feature )

    voidfeaturePermissionRequested(QWebFrame *frame,
    QWebPage::Featurefeature
    )[signal]

    findText ( const QString &, FindFlags )

    boolfindText(const QString &subString,
    FindFlagsoptions = 0
    )

    Finds the specified string, subString, in the page, using the given options.

    If the HighlightAllOccurrences flag is passed, the function will highlight all occurrences that exist in the page. All subsequent calls will extend the highlight, rather than replace it, with occurrences of the new string.

    If the HighlightAllOccurrences flag is not passed, the function will select an occurrence and all subsequent calls will replace the current occurrence with the next one.

    To clear the selection, just pass an empty string.

    Returns true if subString was found; otherwise returns false.

    focusNextPrevChild ( bool )

    boolfocusNextPrevChild(boolnext)

    Similar to QWidget::focusNextPrevChild() it focuses the next focusable web element if next is true; otherwise the previous element is focused.

    Returns true if it can find a new focusable element, or false if it can't.

    forwardUnsupportedContent ( )

    boolforwardUnsupportedContent()const

    frameAt ( const QPoint & )

    QWebFrame *frameAt(const QPoint &pos)const
    Since
    4.6
    Returns the frame at the given point pos, or 0 if there is no frame at that position.

    See also: mainFrame(), currentFrame()

    frameCreated ( QWebFrame * )

    voidframeCreated(QWebFrame *frame)[signal]

    This signal is emitted whenever the page creates a new frame.

    See also: currentFrame()

    geometryChangeRequested ( const QRect & )

    voidgeometryChangeRequested(const QRect &geom)[signal]

    This signal is emitted whenever the document wants to change the position and size of the page to geom. This can happen for example through JavaScript.

    handle ( )

    QWebPagePrivate *handle()const [inline]

    history ( )

    QWebHistory *history()const

    Returns a pointer to the view's history of navigated web pages.

    inputMethodQuery ( Qt::InputMethodQuery )

    QVariant inputMethodQuery(Qt::InputMethodQueryproperty)const

    This method is used by the input method to query a set of properties of the page to be able to support complex input method operations as support for surrounding text and reconversions.

    property specifies which property is queried.

    See also: QWidget::inputMethodEvent(), QInputMethodEvent, QInputContext

    isContentEditable ( )

    boolisContentEditable()const

    isModified ( )

    boolisModified()const

    javaScriptAlert ( QWebFrame *, const QString & )

    voidjavaScriptAlert(QWebFrame *originatingFrame,
    const QString &msg
    )[protected, virtual]

    This function is called whenever a JavaScript program running inside frame calls the alert() function with the message msg.

    The default implementation shows the message, msg, with QMessageBox::information.

    javaScriptConfirm ( QWebFrame *, const QString & )

    booljavaScriptConfirm(QWebFrame *originatingFrame,
    const QString &msg
    )[protected, virtual]

    This function is called whenever a JavaScript program running inside frame calls the confirm() function with the message, msg. Returns true if the user confirms the message; otherwise returns false.

    The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons.

    javaScriptConsoleMessage ( const QString &, int, const QString & )

    voidjavaScriptConsoleMessage(const QString &message,
    intlineNumber,
    const QString &sourceID
    )[protected, virtual]

    This function is called whenever a JavaScript program tries to print a message to the web browser's console.

    For example in case of evaluation errors the source URL may be provided in sourceID as well as the lineNumber.

    The default implementation prints nothing.

    javaScriptPrompt ( QWebFrame *, const QString &, const QString &, QString * )

    booljavaScriptPrompt(QWebFrame *originatingFrame,
    const QString &msg,
    const QString &defaultValue,
    QString *result
    )[protected, virtual]

    This function is called whenever a JavaScript program running inside frame tries to prompt the user for input. The program may provide an optional message, msg, as well as a default value for the input in defaultValue.

    If the prompt was cancelled by the user the implementation should return false; otherwise the result should be written to result and true should be returned. If the prompt was not cancelled by the user, the implementation should return true and the result string must not be null.

    The default implementation uses QInputDialog::getText().

    linkClicked ( const QUrl & )

    voidlinkClicked(const QUrl &url)[signal]

    This signal is emitted whenever the user clicks on a link and the page's linkDelegationPolicy property is set to delegate the link handling for the specified url.

    By default no links are delegated and are handled by QWebPage instead.

    Note:

    This signal possibly won't be emitted for clicked links which use JavaScript to trigger navigation.

    See also: linkHovered()

    linkDelegationPolicy ( )

    LinkDelegationPolicylinkDelegationPolicy()const

    linkHovered ( const QString &, const QString &, const QString & )

    voidlinkHovered(const QString &link,
    const QString &title,
    const QString &textContent
    )[signal]

    This signal is emitted when the mouse hovers over a link.

    link contains the link url. title is the link element's title, if it is specified in the markup. textContent provides text within the link element, e.g., text inside an HTML anchor tag.

    When the mouse leaves the link element the signal is emitted with empty parameters.

    See also: linkClicked()

    loadFinished ( bool )

    voidloadFinished(boolok)[signal]

    This signal is emitted when the page finishes loading content. This signal is independant of script execution or page rendering. ok will indicate whether the load was successful or any error occurred.

    See also: loadStarted(), ErrorPageExtension

    loadProgress ( int )

    voidloadProgress(intprogress)[signal]

    This signal is emitted when the global progress status changes. The current value is provided by progress and scales from 0 to 100, which is the default range of QProgressBar. It accumulates changes from all the child frames.

    See also: bytesReceived()

    loadStarted ( )

    voidloadStarted()[signal]

    This signal is emitted when a page starts loading content.

    See also: loadFinished()

    mainFrame ( )

    QWebFrame *mainFrame()const

    Returns the main frame of the page.

    The main frame provides access to the hierarchy of sub-frames and is also needed if you want to explicitly render a web page into a given painter.

    See also: currentFrame()

    menuBarVisibilityChangeRequested ( bool )

    voidmenuBarVisibilityChangeRequested(boolvisible)[signal]

    This signal is emitted whenever the visibility of the menubar in a web browser window that hosts QWebPage should be changed to visible.

    microFocusChanged ( )

    voidmicroFocusChanged()[signal]

    This signal is emitted when for example the position of the cursor in an editable form element changes. It is used to inform input methods about the new on-screen position where the user is able to enter text. This signal is usually connected to the QWidget::updateMicroFocus() slot.

    networkAccessManager ( )

    QNetworkAccessManager *networkAccessManager()const

    Returns the QNetworkAccessManager that is responsible for serving network requests for this QWebPage.

    See also: setNetworkAccessManager()

    palette ( )

    QPalette palette()const

    pluginFactory ( )

    QWebPluginFactory *pluginFactory()const

    Returns the QWebPluginFactory that is responsible for creating plugins embedded into this QWebPage. If no plugin factory is installed a null pointer is returned.

    See also: setPluginFactory()

    preferredContentsSize ( )

    QSizepreferredContentsSize()const

    printRequested ( QWebFrame * )

    voidprintRequested(QWebFrame *frame)[signal]

    This signal is emitted whenever the page requests the web browser to print frame, for example through the JavaScript {window.print()} call.

    See also: QWebFrame::print(), QPrintPreviewDialog

    qWebKitMajorVersion ( )

    intqWebKitMajorVersion()
    Since
    4.6 Returns the 'major' version number of WebKit at run-time as an integer (for example, 531). This is the version of WebKit the application was compiled against.

    See also: qWebKitVersion()

    qWebKitMinorVersion ( )

    intqWebKitMinorVersion()
    Since
    4.6 Returns the 'minor' version number of WebKit at run-time as an integer (for example, 3). This is the version of WebKit the application was compiled against.

    See also: qWebKitVersion()

    qWebKitVersion ( )

    QString qWebKitVersion()
    Since
    4.6 Returns the version number of WebKit at run-time as a string (for example, "531.3").
    This version is commonly used in WebKit based browsers as part of the user agent string. Web servers and JavaScript might use it to identify the presence of certain WebKit engine features and behaviour.

    The evolution of this version is bound to the releases of Apple's Safari browser. For a version specific to the QtWebKit library, see QTWEBKIT_VERSION

    See also: QWebPage::userAgentForUrl()

    repaintRequested ( const QRect & )

    voidrepaintRequested(const QRect &dirtyRect)[signal]

    This signal is emitted whenever this QWebPage should be updated and no view was set. dirtyRect contains the area that needs to be updated. To paint the QWebPage get the mainFrame() and call the render(QPainter*, const QRegion&) method with the dirtyRect as the second parameter.

    See also: mainFrame() view()

    restoreFrameStateRequested ( QWebFrame * )

    voidrestoreFrameStateRequested(QWebFrame *frame)[signal]
    Since
    4.5
    This signal is emitted when the load of frame is finished and the application may now update its state accordingly.

    saveFrameStateRequested ( QWebFrame *, QWebHistoryItem * )

    voidsaveFrameStateRequested(QWebFrame *frame,
    QWebHistoryItem *item
    )[signal]
    Since
    4.5
    This signal is emitted shortly before the history of navigated pages in frame is changed, for example when navigating back in the history.

    The provided QWebHistoryItem, item, holds the history entry of the frame before the change.

    A potential use-case for this signal is to store custom data in the QWebHistoryItem associated to the frame, using QWebHistoryItem::setUserData().

    scrollRequested ( int, int, const QRect & )

    voidscrollRequested(intdx,
    intdy,
    const QRect &scrollViewRect
    )[signal]

    This signal is emitted whenever the content given by rectToScroll needs to be scrolled dx and dy downwards and no view was set.

    See also: view()

    selectedText ( )

    QString selectedText()const

    selectionChanged ( )

    voidselectionChanged()[signal]

    This signal is emitted whenever the selection changes, either interactively or programmatically (e.g. by calling triggerAction() with a selection action).

    See also: selectedText()

    setActualVisibleContentRect ( const QRect & )

    voidsetActualVisibleContentRect(const QRect &rect)const

    setContentEditable ( bool )

    voidsetContentEditable(booleditable)

    setFeaturePermission ( QWebFrame *, Feature, PermissionPolicy )

    voidsetFeaturePermission(QWebFrame *frame,
    Featurefeature,
    PermissionPolicypolicy
    )

    setForwardUnsupportedContent ( bool )

    voidsetForwardUnsupportedContent(boolforward)

    setLinkDelegationPolicy ( LinkDelegationPolicy )

    voidsetLinkDelegationPolicy(LinkDelegationPolicypolicy)

    setNetworkAccessManager ( QNetworkAccessManager * )

    voidsetNetworkAccessManager(QNetworkAccessManager *manager)

    Sets the QNetworkAccessManager manager responsible for serving network requests for this QWebPage.

    Note:

    It is currently not supported to change the network access manager after the QWebPage has used it. The results of doing this are undefined.

    See also: networkAccessManager()

    setPalette ( const QPalette & )

    voidsetPalette(const QPalette &palette)

    setPluginFactory ( QWebPluginFactory * )

    voidsetPluginFactory(QWebPluginFactory *factory)

    Sets the QWebPluginFactory factory responsible for creating plugins embedded into this QWebPage.

    Note: The plugin factory is only used if the QWebSettings::PluginsEnabled attribute is enabled.

    See also: pluginFactory()

    setPreferredContentsSize ( const QSize & )

    voidsetPreferredContentsSize(const QSize &size)const

    setView ( QWidget * )

    voidsetView(QWidget *view)

    Sets the view that is associated with the web page.

    See also: view()

    setViewportSize ( const QSize & )

    voidsetViewportSize(const QSize &size)const

    settings ( )

    QWebSettings *settings()const

    Returns a pointer to the page's settings object.

    See also: QWebSettings::globalSettings()

    shouldInterruptJavaScript ( )

    boolshouldInterruptJavaScript()[slot]
    Since
    4.6 This function is called when a JavaScript program is running for a long period of time.
    If the user wanted to stop the JavaScript the implementation should return true; otherwise false.

    The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons.

    CAUTION:

    Because of binary compatibility constraints, this function is not virtual. If you want to provide your own implementation in a QWebPage subclass, reimplement the shouldInterruptJavaScript() slot in your subclass instead. QtWebKit will dynamically detect the slot and call it.

    statusBarMessage ( const QString & )

    voidstatusBarMessage(const QString &text)[signal]

    This signal is emitted when the statusbar text is changed by the page.

    statusBarVisibilityChangeRequested ( bool )

    voidstatusBarVisibilityChangeRequested(boolvisible)[signal]

    This signal is emitted whenever the visibility of the statusbar in a web browser window that hosts QWebPage should be changed to visible.

    supportsExtension ( Extension )

    boolsupportsExtension(Extensionextension)const [virtual]

    This virtual function returns true if the web page supports extension; otherwise false is returned.

    See also: extension()

    swallowContextMenuEvent ( QContextMenuEvent * )

    boolswallowContextMenuEvent(QContextMenuEvent *event)

    Filters the context menu event, event, through handlers for scrollbars and custom event handlers in the web page. Returns true if the event was handled; otherwise false.

    A web page may swallow a context menu event through a custom event handler, allowing for context menus to be implemented in HTML/JavaScript. This is used by {http://maps.google.com/}{Google Maps}, for example.

    toolBarVisibilityChangeRequested ( bool )

    voidtoolBarVisibilityChangeRequested(boolvisible)[signal]

    This signal is emitted whenever the visibility of the toolbar in a web browser window that hosts QWebPage should be changed to visible.

    totalBytes ( )

    quint64 totalBytes()const

    Returns the total number of bytes that were received from the network to render the current page, including extra content such as embedded images.

    See also: bytesReceived()

    triggerAction ( WebAction, bool )

    voidtriggerAction(WebActionaction,
    boolchecked = false
    )[virtual]

    This function can be called to trigger the specified action. It is also called by QtWebKit if the user triggers the action, for example through a context menu item.

    If action is a checkable action then checked specified whether the action is toggled or not.

    See also: action()

    undoStack ( )

    QUndoStack *undoStack()const

    Returns a pointer to the undo stack used for editable content.

    See also: modified

    unsupportedContent ( QNetworkReply * )

    voidunsupportedContent(QNetworkReply *reply)[signal]

    This signal is emitted when WebKit cannot handle a link the user navigated to or a web server's response includes a "Content-Disposition" header with the 'attachment' directive. If "Content-Disposition" is present in reply, the web server is indicating that the client should prompt the user to save the content regardless of content-type. See RFC 2616 sections 19.5.1 for details about Content-Disposition.

    At signal emission time the meta-data of the QNetworkReply reply is available.

    Note:

    This signal is only emitted if the forwardUnsupportedContent property is set to true.

    See also: downloadRequested()

    updatePositionDependentActions ( const QPoint & )

    voidupdatePositionDependentActions(const QPoint &pos)

    Updates the page's actions depending on the position pos. For example if pos is over an image element the CopyImageToClipboard action is enabled.

    userAgentForUrl ( const QUrl & )

    QString userAgentForUrl(const QUrl &url)const [protected, virtual]

    This function is called when a user agent for HTTP requests is needed. You can reimplement this function to dynamically return different user agents for different URLs, based on the url parameter.

    The default implementation returns the following value:

    "Mozilla/5.0 (%Platform%; %Security%; %Subplatform%; %Locale%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%"

    On mobile platforms such as Symbian S60 and Maemo, "Mobile Safari" is used instead of "Safari".

    In this string the following values are replaced at run-time: Platform% and Subplatform% are expanded to the windowing system and the operation system. Security% expands to U if SSL is enabled, otherwise N. SSL is enabled if QSslSocket::supportsSsl() returns true. Locale% is replaced with QLocale::name(). The locale is determined from the view of the QWebPage. If no view is set on the QWebPage, then a default constructed QLocale is used instead. WebKitVersion% is the version of WebKit the application was compiled against. AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version.

    view ( )

    QWidget *view()const

    Returns the view widget that is associated with the web page.

    See also: setView()

    viewportAttributesForSize ( const QSize & )

    ViewportAttributes viewportAttributesForSize(const QSize &availableSize)const

    Computes the optimal viewport configuration given the availableSize, when user interface components are disregarded.

    The configuration is also dependent on the device screen size which is obtained automatically. For testing purposes the size can be overridden by setting two environment variables QTWEBKIT_DEVICE_WIDTH and QTWEBKIT_DEVICE_HEIGHT, which both needs to be set.

    viewportChangeRequested ( )

    voidviewportChangeRequested()[signal]
    Since
    4.7
    Page authors can provide the supplied values by using the viewport meta tag. More information about this can be found at {http://developer.apple.com/safari/library/documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html}{Safari Reference Library: Using the Viewport Meta Tag}.

    See also: QWebPage::ViewportAttributes, setPreferredContentsSize(), QGraphicsWebView::setScale()

    viewportSize ( )

    QSizeviewportSize()const

    windowCloseRequested ( )

    voidwindowCloseRequested()[signal]

    This signal is emitted whenever the page requests the web browser window to be closed, for example through the JavaScript {window.close()} call.