QWebPage Class Reference

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

#include <qwebpage.h>

Collaboration diagram for QWebPage:
Collaboration graph
[legend]

List of all members.

Classes

class  ChooseMultipleFilesExtensionOption
 The ChooseMultipleFilesExtensionOption class describes the option for the multiple files selection extension. More...
class  ChooseMultipleFilesExtensionReturn
 The ChooseMultipleFilesExtensionReturn describes the return value for the multiple files selection extension. More...
class  ErrorPageExtensionOption
 The ErrorPageExtensionOption class describes the option for the error page extension. More...
class  ErrorPageExtensionReturn
 The ErrorPageExtensionReturn describes the error page, which will be shown for the frame for which the error occured. More...
class  ExtensionOption
 The ExtensionOption class provides an extended input argument to QWebPage's extension support. More...
class  ExtensionReturn

Public Types

enum  NavigationType {
  NavigationTypeLinkClicked, NavigationTypeFormSubmitted, NavigationTypeBackOrForward, NavigationTypeReload,
  NavigationTypeFormResubmitted, NavigationTypeOther
}
enum  WebAction {
  NoWebAction = - 1, OpenLink, OpenLinkInNewWindow, OpenFrameInNewWindow,
  DownloadLinkToDisk, CopyLinkToClipboard, OpenImageInNewWindow, DownloadImageToDisk,
  CopyImageToClipboard, Back, Forward, Stop,
  Reload, Cut, Copy, Paste,
  Undo, Redo, MoveToNextChar, MoveToPreviousChar,
  MoveToNextWord, MoveToPreviousWord, MoveToNextLine, MoveToPreviousLine,
  MoveToStartOfLine, MoveToEndOfLine, MoveToStartOfBlock, MoveToEndOfBlock,
  MoveToStartOfDocument, MoveToEndOfDocument, SelectNextChar, SelectPreviousChar,
  SelectNextWord, SelectPreviousWord, SelectNextLine, SelectPreviousLine,
  SelectStartOfLine, SelectEndOfLine, SelectStartOfBlock, SelectEndOfBlock,
  SelectStartOfDocument, SelectEndOfDocument, DeleteStartOfWord, DeleteEndOfWord,
  SetTextDirectionDefault, SetTextDirectionLeftToRight, SetTextDirectionRightToLeft, ToggleBold,
  ToggleItalic, ToggleUnderline, InspectElement, InsertParagraphSeparator,
  InsertLineSeparator, SelectAll, ReloadAndBypassCache, PasteAndMatchStyle,
  RemoveFormat, ToggleStrikethrough, ToggleSubscript, ToggleSuperscript,
  InsertUnorderedList, InsertOrderedList, Indent, Outdent,
  AlignCenter, AlignJustified, AlignLeft, AlignRight,
  WebActionCount
}
enum  FindFlag { FindBackward = 1, FindCaseSensitively = 2, FindWrapsAroundDocument = 4, HighlightAllOccurrences = 8 }
enum  LinkDelegationPolicy { DontDelegateLinks, DelegateExternalLinks, DelegateAllLinks }
enum  WebWindowType { WebBrowserWindow, WebModalDialog }
enum  Extension { ChooseMultipleFilesExtension, ErrorPageExtension }
enum  ErrorDomain { QtNetwork, Http, WebKit }

Public Slots

bool shouldInterruptJavaScript ()

Signals

void loadStarted ()
void loadProgress (int progress)
void loadFinished (bool ok)
void linkHovered (const QString &link, const QString &title, const QString &textContent)
void statusBarMessage (const QString &text)
void selectionChanged ()
void frameCreated (QWebFrame *frame)
void geometryChangeRequested (const QRect &geom)
void repaintRequested (const QRect &dirtyRect)
void scrollRequested (int dx, int dy, const QRect &scrollViewRect)
void windowCloseRequested ()
void printRequested (QWebFrame *frame)
void linkClicked (const QUrl &url)
void toolBarVisibilityChangeRequested (bool visible)
void statusBarVisibilityChangeRequested (bool visible)
void menuBarVisibilityChangeRequested (bool visible)
void unsupportedContent (QNetworkReply *reply)
void downloadRequested (const QNetworkRequest &request)
void microFocusChanged ()
void contentsChanged ()
void databaseQuotaExceeded (QWebFrame *frame, QString databaseName)
void saveFrameStateRequested (QWebFrame *frame, QWebHistoryItem *item)
void restoreFrameStateRequested (QWebFrame *frame)

Public Member Functions

 QWebPage (QObject *parent=0)
 ~QWebPage ()
QWebFramemainFrame () const
QWebFramecurrentFrame () const
QWebFrameframeAt (const QPoint &pos) const
QWebHistory * history () const
QWebSettings * settings () const
void setView (QWidget *view)
QWidget * view () const
bool isModified () const
QUndoStack * undoStack () const
void setNetworkAccessManager (QNetworkAccessManager *manager)
QNetworkAccessManager * networkAccessManager () const
void setPluginFactory (QWebPluginFactory *factory)
QWebPluginFactory * pluginFactory () const
quint64 totalBytes () const
quint64 bytesReceived () const
QString selectedText () const
QAction * action (WebAction action) const
virtual void triggerAction (WebAction action, bool checked=false)
QSize viewportSize () const
void setViewportSize (const QSize &size) const
QSize preferredContentsSize () const
void setPreferredContentsSize (const QSize &size) const
virtual bool event (QEvent *)
bool focusNextPrevChild (bool next)
QVariant inputMethodQuery (Qt::InputMethodQuery property) const
bool findText (const QString &subString, FindFlags options=0)
void setForwardUnsupportedContent (bool forward)
bool forwardUnsupportedContent () const
void setLinkDelegationPolicy (LinkDelegationPolicy policy)
LinkDelegationPolicy linkDelegationPolicy () const
void setPalette (const QPalette &palette)
QPalette palette () const
void setContentEditable (bool editable)
bool isContentEditable () const
bool swallowContextMenuEvent (QContextMenuEvent *event)
void updatePositionDependentActions (const QPoint &pos)
QMenu * createStandardContextMenu ()
virtual bool extension (Extension extension, const ExtensionOption *option=0, ExtensionReturn *output=0)
virtual bool supportsExtension (Extension extension) const
QWebPagePrivatehandle () const

Protected Member Functions

virtual QWebPagecreateWindow (WebWindowType type)
virtual QObject * createPlugin (const QString &classid, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
virtual bool acceptNavigationRequest (QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
virtual QString chooseFile (QWebFrame *originatingFrame, const QString &oldFile)
virtual void javaScriptAlert (QWebFrame *originatingFrame, const QString &msg)
virtual bool javaScriptConfirm (QWebFrame *originatingFrame, const QString &msg)
virtual bool javaScriptPrompt (QWebFrame *originatingFrame, const QString &msg, const QString &defaultValue, QString *result)
virtual void javaScriptConsoleMessage (const QString &message, int lineNumber, const QString &sourceID)
virtual QString userAgentForUrl (const QUrl &url) const

Properties

bool modified
 whether the page contains unsubmitted form data
QString selectedText
 the text currently selected
QSize viewportSize
 the size of the viewport
QSize preferredContentsSize
 the size of the fixed layout
bool forwardUnsupportedContent
 whether QWebPage should forward unsupported content
LinkDelegationPolicy linkDelegationPolicy
 how QWebPage should delegate the handling of links through the linkClicked() signal
QPalette palette
 the page's palette
bool contentEditable
 whether the content in this QWebPage is editable or not

Private Attributes

QWebPagePrivated

Friends

class QWebFrame
class QWebPagePrivate
class QWebView
class QGraphicsWebView
class QWebInspector
class WebCore::ChromeClientQt
class WebCore::EditorClientQt
class WebCore::FrameLoaderClientQt
class WebCore::InspectorClientQt
class WebCore::ResourceHandle
class WebCore::QNetworkReplyHandler

Detailed Description

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

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()} in QWebView), triggerAction(), findText() and settings(). More QWebView-like functions can be found in the main frame of QWebPage, obtained via QWebPage::mainFrame(). For example, the load(), setUrl() and setHtml() unctions 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 has loaded completely. Its argument, either true or false, indicates whether or not the load operation succeeded.

Definition at line 64 of file qwebpage.h.


Member Enumeration Documentation

Since:
4.6
Enumerator:
QtNetwork 
Http 
WebKit 

Definition at line 277 of file qwebpage.h.

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 (introduced in Qt 4.6)

Enumerator:
ChooseMultipleFilesExtension 
ErrorPageExtension 

Definition at line 257 of file qwebpage.h.

This enum describes the options available to QWebPage's 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.

Enumerator:
FindBackward 
FindCaseSensitively 
FindWrapsAroundDocument 
HighlightAllOccurrences 

Definition at line 174 of file qwebpage.h.

This enum defines the delegation policies a webpage can have when activating links and emitting the linkClicked() signal.

DontDelegateLinks No links are delegated. Instead, QWebPage tries to handle them all. DelegateExternalLinks When activating links that point to documents not stored on the local filesystem or an equivalent - such as the Qt resource system - then linkClicked() is emitted. DelegateAllLinks Whenever a link is activated the linkClicked() signal is emitted.

Enumerator:
DontDelegateLinks 
DelegateExternalLinks 
DelegateAllLinks 

Definition at line 182 of file qwebpage.h.

This enum describes the types of navigation available when browsing through hyperlinked documents.

NavigationTypeLinkClicked The user clicked on a link or pressed return on a focused link. NavigationTypeFormSubmitted The user activated a submit button for an HTML form. NavigationTypeBackOrForward Navigation to a previously shown document in the back or forward history is requested. NavigationTypeReload The user activated the reload action. NavigationTypeFormResubmitted An HTML form was submitted a second time. NavigationTypeOther A navigation to another document using a method not listed above.

Enumerator:
NavigationTypeLinkClicked 
NavigationTypeFormSubmitted 
NavigationTypeBackOrForward 
NavigationTypeReload 
NavigationTypeFormResubmitted 
NavigationTypeOther 

Definition at line 77 of file qwebpage.h.

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 {QWebPage::}{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. 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

Enumerator:
NoWebAction 
OpenLink 
OpenLinkInNewWindow 
OpenFrameInNewWindow 
DownloadLinkToDisk 
CopyLinkToClipboard 
OpenImageInNewWindow 
DownloadImageToDisk 
CopyImageToClipboard 
Back 
Forward 
Stop 
Reload 
Cut 
Copy 
Paste 
Undo 
Redo 
MoveToNextChar 
MoveToPreviousChar 
MoveToNextWord 
MoveToPreviousWord 
MoveToNextLine 
MoveToPreviousLine 
MoveToStartOfLine 
MoveToEndOfLine 
MoveToStartOfBlock 
MoveToEndOfBlock 
MoveToStartOfDocument 
MoveToEndOfDocument 
SelectNextChar 
SelectPreviousChar 
SelectNextWord 
SelectPreviousWord 
SelectNextLine 
SelectPreviousLine 
SelectStartOfLine 
SelectEndOfLine 
SelectStartOfBlock 
SelectEndOfBlock 
SelectStartOfDocument 
SelectEndOfDocument 
DeleteStartOfWord 
DeleteEndOfWord 
SetTextDirectionDefault 
SetTextDirectionLeftToRight 
SetTextDirectionRightToLeft 
ToggleBold 
ToggleItalic 
ToggleUnderline 
InspectElement 
InsertParagraphSeparator 
InsertLineSeparator 
SelectAll 
ReloadAndBypassCache 
PasteAndMatchStyle 
RemoveFormat 
ToggleStrikethrough 
ToggleSubscript 
ToggleSuperscript 
InsertUnorderedList 
InsertOrderedList 
Indent 
Outdent 
AlignCenter 
AlignJustified 
AlignLeft 
AlignRight 
WebActionCount 

Definition at line 86 of file qwebpage.h.

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

Enumerator:
WebBrowserWindow 
WebModalDialog 

Definition at line 188 of file qwebpage.h.


Constructor & Destructor Documentation

QWebPage::QWebPage ( QObject *  parent = 0  )  [explicit]

Constructs an empty QWebPage with parent parent.

Definition at line 1955 of file qwebpage.cpp.

References loadProgress(), and setView().

Here is the call graph for this function:

QWebPage::~QWebPage (  ) 

Destroys the web page.

Definition at line 1970 of file qwebpage.cpp.

References QWebPagePrivate::createMainFrame(), d, QWebPagePrivate::inspector, QWebPagePrivate::inspectorIsInternalOnly, QWebPagePrivate::mainFrame, and QWebPagePrivate::setInspector().

Here is the call graph for this function:


Member Function Documentation

bool QWebPage::acceptNavigationRequest ( QWebFrame frame,
const QNetworkRequest &  request,
QWebPage::NavigationType  type 
) [protected, virtual]

This function is called whenever WebKit requests to navigate frame to the resource specified by request by means of the specified navigation type type.

If frame is a null pointer then navigation to a new window is requested. If the request is accepted createWindow() will be called.

The default implementation interprets the page's linkDelegationPolicy and emits linkClicked accordingly or returns true to let QWebPage handle the navigation itself.

See also:
createWindow()

Definition at line 2409 of file qwebpage.cpp.

References d, DelegateAllLinks, DelegateExternalLinks, DontDelegateLinks, linkClicked(), QWebPagePrivate::linkPolicy, and NavigationTypeLinkClicked.

Here is the call graph for this function:

QAction * QWebPage::action ( WebAction  action  )  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()

Definition at line 2456 of file qwebpage.cpp.

References QWebPagePrivate::actions, AlignCenter, AlignJustified, AlignLeft, AlignRight, Back, Copy, CopyImageToClipboard, CopyLinkToClipboard, Cut, d, DeleteEndOfWord, DeleteStartOfWord, DownloadImageToDisk, DownloadLinkToDisk, Forward, Indent, InsertLineSeparator, InsertOrderedList, InsertParagraphSeparator, InsertUnorderedList, InspectElement, MoveToEndOfBlock, MoveToEndOfDocument, MoveToEndOfLine, MoveToNextChar, MoveToNextLine, MoveToNextWord, MoveToPreviousChar, MoveToPreviousLine, MoveToPreviousWord, MoveToStartOfBlock, MoveToStartOfDocument, MoveToStartOfLine, NoWebAction, OpenFrameInNewWindow, OpenImageInNewWindow, OpenLink, OpenLinkInNewWindow, Outdent, Paste, PasteAndMatchStyle, QWebPagePrivate::q, Redo, Reload, RemoveFormat, SelectAll, SelectEndOfBlock, SelectEndOfDocument, SelectEndOfLine, SelectNextChar, SelectNextLine, SelectNextWord, SelectPreviousChar, SelectPreviousLine, SelectPreviousWord, SelectStartOfBlock, SelectStartOfDocument, SelectStartOfLine, SetTextDirectionDefault, SetTextDirectionLeftToRight, SetTextDirectionRightToLeft, Stop, ToggleBold, ToggleItalic, ToggleStrikethrough, ToggleSubscript, ToggleSuperscript, ToggleUnderline, Undo, undoStack(), QWebPagePrivate::updateAction(), and view().

Here is the call graph for this function:

quint64 QWebPage::bytesReceived (  )  const

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

See also:
totalBytes()

Definition at line 3576 of file qwebpage.cpp.

References d, and QWebPagePrivate::m_bytesReceived.

QString QWebPage::chooseFile ( QWebFrame parentFrame,
const QString &  suggestedFile 
) [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.

Definition at line 3239 of file qwebpage.cpp.

References view().

Here is the call graph for this function:

void QWebPage::contentsChanged (  )  [signal]
Since:
4.5

This signal is emitted whenever the text in form elements changes as well as other editable content.

See also:
contentEditable, QWebFrame::toHtml(), QWebFrame::toPlainText()
QObject * QWebPage::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". The classid, url, paramNames and paramValues correspond to the HTML object element attributes and child elements to configure the embeddable object.

Definition at line 2194 of file qwebpage.cpp.

QMenu * QWebPage::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.

Definition at line 965 of file qwebpage.cpp.

References QWebPagePrivate::currentContextMenu, and d.

QWebPage * QWebPage::createWindow ( WebWindowType  type  )  [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.

See also:
acceptNavigationRequest()

Definition at line 2178 of file qwebpage.cpp.

References QWebView::createWindow(), QWebView::page(), and view().

Here is the call graph for this function:

QWebFrame * QWebPage::currentFrame (  )  const

Returns the frame currently active.

See also:
mainFrame(), frameCreated()

Definition at line 2006 of file qwebpage.cpp.

References QWebPagePrivate::createMainFrame(), d, QWebPagePrivate::page, and WebCore::FrameLoaderClientQt.

Here is the call graph for this function:

void QWebPage::databaseQuotaExceeded ( QWebFrame frame,
QString  databaseName 
) [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.

void QWebPage::downloadRequested ( 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()
bool QWebPage::event ( QEvent *  ev  )  [virtual]
bool QWebPage::extension ( Extension  extension,
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.

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

Definition at line 3155 of file qwebpage.cpp.

References ChooseMultipleFilesExtension, and view().

Here is the call graph for this function:

bool QWebPage::findText ( const QString &  subString,
FindFlags  options = 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.

Definition at line 3199 of file qwebpage.cpp.

References d, FindBackward, FindCaseSensitively, FindWrapsAroundDocument, HighlightAllOccurrences, and QWebPagePrivate::page.

bool QWebPage::focusNextPrevChild ( bool  next  ) 

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.

Definition at line 2862 of file qwebpage.cpp.

References d, QWebPagePrivate::keyPressEvent(), and QWebPagePrivate::page.

Here is the call graph for this function:

bool QWebPage::forwardUnsupportedContent (  )  const
QWebFrame * QWebPage::frameAt ( const QPoint &  pos  )  const
Since:
4.6

Returns the frame at the given point pos.

See also:
mainFrame(), currentFrame()

Definition at line 2020 of file qwebpage.cpp.

References QWebHitTestResult::frame(), QWebFrame::geometry(), QWebFrame::hitTestContent(), and mainFrame().

Here is the call graph for this function:

void QWebPage::frameCreated ( QWebFrame frame  )  [signal]

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

void QWebPage::geometryChangeRequested ( 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.

QWebPagePrivate * QWebPage::handle (  )  const [inline]

Definition at line 300 of file qwebpage.h.

QWebHistory * QWebPage::history (  )  const

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

Definition at line 2032 of file qwebpage.cpp.

References QWebPagePrivate::createMainFrame(), d, and QWebPagePrivate::history.

Here is the call graph for this function:

QVariant QWebPage::inputMethodQuery ( Qt::InputMethodQuery  property  )  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

Definition at line 1618 of file qwebpage.cpp.

References d, QWebPagePrivate::page, and view().

Here is the call graph for this function:

bool QWebPage::isContentEditable (  )  const

Definition at line 2904 of file qwebpage.cpp.

References d, and QWebPagePrivate::editable.

bool QWebPage::isModified (  )  const

Definition at line 2724 of file qwebpage.cpp.

References d, and QWebPagePrivate::undoStack.

void QWebPage::javaScriptAlert ( QWebFrame frame,
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.

Definition at line 2099 of file qwebpage.cpp.

References mainFrame(), and view().

Here is the call graph for this function:

bool QWebPage::javaScriptConfirm ( QWebFrame frame,
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.

Definition at line 2113 of file qwebpage.cpp.

References mainFrame(), and view().

Here is the call graph for this function:

void QWebPage::javaScriptConsoleMessage ( const QString &  message,
int  lineNumber,
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.

Definition at line 2086 of file qwebpage.cpp.

bool QWebPage::javaScriptPrompt ( QWebFrame frame,
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.

Definition at line 2133 of file qwebpage.cpp.

References mainFrame(), and view().

Here is the call graph for this function:

void QWebPage::linkClicked ( 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.

See also:
linkHovered()
LinkDelegationPolicy QWebPage::linkDelegationPolicy (  )  const
void QWebPage::linkHovered ( 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()
void QWebPage::loadFinished ( bool  ok  )  [signal]

This signal is emitted when a load of the page is finished. ok will indicate whether the load was successful or any error occurred.

See also:
loadStarted()
void QWebPage::loadProgress ( int  progress  )  [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()
void QWebPage::loadStarted (  )  [signal]

This signal is emitted when a new load of the page is started.

See also:
loadFinished()
QWebFrame * QWebPage::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()

Definition at line 1995 of file qwebpage.cpp.

References QWebPagePrivate::createMainFrame(), d, and QWebPagePrivate::mainFrame.

Here is the call graph for this function:

void QWebPage::menuBarVisibilityChangeRequested ( bool  visible  )  [signal]

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

void QWebPage::microFocusChanged (  )  [signal]

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

QNetworkAccessManager * QWebPage::networkAccessManager (  )  const

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

See also:
setNetworkAccessManager()

Definition at line 3273 of file qwebpage.cpp.

References d, and QWebPagePrivate::networkManager.

QPalette QWebPage::palette (  )  const
QWebPluginFactory * QWebPage::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()

Definition at line 3301 of file qwebpage.cpp.

References d, and QWebPagePrivate::pluginFactory.

QSize QWebPage::preferredContentsSize (  )  const
void QWebPage::printRequested ( 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
void QWebPage::repaintRequested ( 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()
void QWebPage::restoreFrameStateRequested ( 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.

void QWebPage::saveFrameStateRequested ( 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().

void QWebPage::scrollRequested ( int  dx,
int  dy,
const QRect &  rectToScroll 
) [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()
QString QWebPage::selectedText (  )  const
void QWebPage::selectionChanged (  )  [signal]

This signal is emitted whenever the selection changes.

See also:
selectedText()
void QWebPage::setContentEditable ( bool  editable  ) 

Definition at line 2885 of file qwebpage.cpp.

References d, QWebPagePrivate::editable, QWebPagePrivate::mainFrame, QWebPagePrivate::page, and QWebPagePrivate::updateEditorActions().

Here is the call graph for this function:

void QWebPage::setForwardUnsupportedContent ( bool  forward  ) 

Definition at line 2921 of file qwebpage.cpp.

References d, and QWebPagePrivate::forwardUnsupportedContent.

void QWebPage::setLinkDelegationPolicy ( LinkDelegationPolicy  policy  ) 

Definition at line 2939 of file qwebpage.cpp.

References d, and QWebPagePrivate::linkPolicy.

void QWebPage::setNetworkAccessManager ( 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()

Definition at line 3258 of file qwebpage.cpp.

References d, and QWebPagePrivate::networkManager.

void QWebPage::setPalette ( const QPalette &  palette  ) 

Definition at line 1276 of file qwebpage.cpp.

References d, QWebPagePrivate::mainFrame, and QWebPagePrivate::palette.

void QWebPage::setPluginFactory ( 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()

Definition at line 3290 of file qwebpage.cpp.

References d, and QWebPagePrivate::pluginFactory.

void QWebPage::setPreferredContentsSize ( const QSize &  size  )  const

Definition at line 2376 of file qwebpage.cpp.

References QWebFrame::d, d, QWebPagePrivate::fixedLayoutSize, and mainFrame().

Here is the call graph for this function:

QWebSettings * QWebPage::settings (  )  const

Returns a pointer to the page's settings object.

See also:
QWebSettings::globalSettings()

Definition at line 3227 of file qwebpage.cpp.

References d, and QWebPagePrivate::settings.

void QWebPage::setView ( QWidget *  view  ) 

Sets the view that is associated with the web page.

See also:
view()

Definition at line 2043 of file qwebpage.cpp.

References QWebPagePrivate::client, d, QWebPagePrivate::PageScrollMoveThreshold, setViewportSize(), QWebPagePrivate::view, and view().

Here is the call graph for this function:

void QWebPage::setViewportSize ( const QSize &  size  )  const

Definition at line 2342 of file qwebpage.cpp.

References QWebFrame::d, d, mainFrame(), view(), and QWebPagePrivate::viewportSize.

Here is the call graph for this function:

bool QWebPage::shouldInterruptJavaScript (  )  [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.

Warning:
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.

Definition at line 2158 of file qwebpage.cpp.

References mainFrame(), and view().

Here is the call graph for this function:

void QWebPage::statusBarMessage ( const QString &  text  )  [signal]

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

void QWebPage::statusBarVisibilityChangeRequested ( bool  visible  )  [signal]

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

bool QWebPage::supportsExtension ( Extension  extension  )  const [virtual]

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

See also:
extension()

Definition at line 3175 of file qwebpage.cpp.

References ChooseMultipleFilesExtension.

bool QWebPage::swallowContextMenuEvent ( 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.

Definition at line 2959 of file qwebpage.cpp.

References d, frameAt(), and QWebPagePrivate::page.

Here is the call graph for this function:

void QWebPage::toolBarVisibilityChangeRequested ( bool  visible  )  [signal]

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

quint64 QWebPage::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()

Definition at line 3565 of file qwebpage.cpp.

References d, and QWebPagePrivate::m_totalBytes.

void QWebPage::triggerAction ( WebAction  action,
bool  checked = false 
) [virtual]
QUndoStack * QWebPage::undoStack (  )  const

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

Definition at line 2739 of file qwebpage.cpp.

References d, and QWebPagePrivate::undoStack.

void QWebPage::unsupportedContent ( QNetworkReply *  reply  )  [signal]

This signal is emitted when WebKit cannot handle a link the user navigated to.

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()
void QWebPage::updatePositionDependentActions ( 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.

Definition at line 2984 of file qwebpage.cpp.

References action(), QWebPagePrivate::createContextMenu(), QWebPagePrivate::createMainFrame(), QWebPagePrivate::currentContextMenu, d, QWebPagePrivate::hitTestResult, QWebPagePrivate::page, WebCore::HitTestResult::scrollbar(), WebActionCount, and webActionForContextMenuAction().

Here is the call graph for this function:

QString QWebPage::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%"

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()/QCoreApplicationapplicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version.

Definition at line 3324 of file qwebpage.cpp.

References view().

Here is the call graph for this function:

QWidget * QWebPage::view (  )  const

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

See also:
setView()

Definition at line 2070 of file qwebpage.cpp.

References d, and QWebPagePrivate::view.

QSize QWebPage::viewportSize (  )  const
void QWebPage::windowCloseRequested (  )  [signal]

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


Friends And Related Function Documentation

friend class QGraphicsWebView [friend]

Definition at line 361 of file qwebpage.h.

friend class QWebFrame [friend]

Definition at line 358 of file qwebpage.h.

friend class QWebInspector [friend]

Definition at line 362 of file qwebpage.h.

friend class QWebPagePrivate [friend]

Definition at line 359 of file qwebpage.h.

friend class QWebView [friend]

Definition at line 360 of file qwebpage.h.

friend class WebCore::ChromeClientQt [friend]

Definition at line 363 of file qwebpage.h.

friend class WebCore::EditorClientQt [friend]

Definition at line 364 of file qwebpage.h.

friend class WebCore::FrameLoaderClientQt [friend]

Definition at line 365 of file qwebpage.h.

friend class WebCore::InspectorClientQt [friend]

Definition at line 366 of file qwebpage.h.

friend class WebCore::QNetworkReplyHandler [friend]

Definition at line 368 of file qwebpage.h.

friend class WebCore::ResourceHandle [friend]

Definition at line 367 of file qwebpage.h.


Member Data Documentation

Definition at line 356 of file qwebpage.h.


Property Documentation

QWebPage::contentEditable [read, write]

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.

Definition at line 74 of file qwebpage.h.

bool QWebPage::forwardUnsupportedContent [read, write]

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.

Definition at line 71 of file qwebpage.h.

QWebPage::LinkDelegationPolicy QWebPage::linkDelegationPolicy [read, write]

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

The default is to delegate no links.

Definition at line 72 of file qwebpage.h.

QWebPage::modified [read]

whether the page contains unsubmitted form data

By default, this property is false.

Definition at line 67 of file qwebpage.h.

QPalette QWebPage::palette [read, write]

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.

Definition at line 73 of file qwebpage.h.

QWebPage::preferredContentsSize [read, write]

the size of the fixed layout

Since:
4.6 The size affects the layout of the page in the viewport. If set to a fixed size of 1024x768 for example then webkit will layout the page as if the viewport were that size rather than something different.

Definition at line 70 of file qwebpage.h.

QString QWebPage::selectedText [read]

the text currently selected

By default, this property contains an empty string.

See also:
selectionChanged()

Definition at line 68 of file qwebpage.h.

QWebPage::viewportSize [read, write]

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.

Definition at line 69 of file qwebpage.h.


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208