Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtWebKit.QWebPage Class Reference

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

Inheritance diagram for QtWebKit.QWebPage:
Collaboration diagram for QtWebKit.QWebPage:

Classes

class  ChooseMultipleFilesExtensionOption
 
class  ChooseMultipleFilesExtensionReturn
 
class  ErrorPageExtensionOption
 
class  ErrorPageExtensionReturn
 
class  ExtensionOption
 
class  ExtensionReturn
 
class  ViewportAttributes
 The QWebPage::ViewportAttributes class describes hints that can be applied to a viewport. More...
 

Public Types

enum  ErrorDomain { Http = 1, QtNetwork = 0, WebKit = 2 }
  More...
 
enum  Extension { ChooseMultipleFilesExtension = 0, ErrorPageExtension = 1 }
  More...
 
enum  Feature { Geolocation = 1, Notifications = 0 }
 
enum  FindFlag { FindBackward = 1, FindCaseSensitively = 2, FindWrapsAroundDocument = 4, HighlightAllOccurrences = 8 }
  More...
 
enum  LinkDelegationPolicy { DelegateAllLinks = 2, DelegateExternalLinks = 1, DontDelegateLinks = 0 }
  More...
 
enum  NavigationType {
  NavigationTypeBackOrForward = 2, NavigationTypeFormResubmitted = 4, NavigationTypeFormSubmitted = 1, NavigationTypeLinkClicked = 0,
  NavigationTypeOther = 5, NavigationTypeReload = 3
}
  More...
 
enum  PermissionPolicy { PermissionDeniedByUser = 2, PermissionGrantedByUser = 1, PermissionUnknown = 0 }
 
enum  WebAction {
  AlignCenter = 63, AlignJustified = 64, AlignLeft = 65, AlignRight = 66,
  Back = 8, Copy = 13, CopyImageToClipboard = 7, CopyImageUrlToClipboard = 68,
  CopyLinkToClipboard = 4, Cut = 12, DeleteEndOfWord = 42, DeleteStartOfWord = 41,
  DownloadImageToDisk = 6, DownloadLinkToDisk = 3, Forward = 9, Indent = 61,
  InsertLineSeparator = 51, InsertOrderedList = 60, InsertParagraphSeparator = 50, InsertUnorderedList = 59,
  InspectElement = 49, MoveToEndOfBlock = 26, MoveToEndOfDocument = 28, MoveToEndOfLine = 24,
  MoveToNextChar = 17, MoveToNextLine = 21, MoveToNextWord = 19, MoveToPreviousChar = 18,
  MoveToPreviousLine = 22, MoveToPreviousWord = 20, MoveToStartOfBlock = 25, MoveToStartOfDocument = 27,
  MoveToStartOfLine = 23, NoWebAction = -1, OpenFrameInNewWindow = 2, OpenImageInNewWindow = 5,
  OpenLink = 0, OpenLinkInNewWindow = 1, Outdent = 62, Paste = 14,
  PasteAndMatchStyle = 54, Redo = 16, Reload = 11, ReloadAndBypassCache = 53,
  RemoveFormat = 55, SelectAll = 52, SelectEndOfBlock = 38, SelectEndOfDocument = 40,
  SelectEndOfLine = 36, SelectNextChar = 29, SelectNextLine = 33, SelectNextWord = 31,
  SelectPreviousChar = 30, SelectPreviousLine = 34, SelectPreviousWord = 32, SelectStartOfBlock = 37,
  SelectStartOfDocument = 39, SelectStartOfLine = 35, SetTextDirectionDefault = 43, SetTextDirectionLeftToRight = 44,
  SetTextDirectionRightToLeft = 45, Stop = 10, StopScheduledPageRefresh = 67, ToggleBold = 46,
  ToggleItalic = 47, ToggleStrikethrough = 56, ToggleSubscript = 57, ToggleSuperscript = 58,
  ToggleUnderline = 48, Undo = 15, WebActionCount = 69
}
  More...
 
enum  WebWindowType { WebBrowserWindow = 0, WebModalDialog = 1 }
  More...
 

Public Member Functions

 QWebPage (QObject parent=null)
 
 
override void CreateProxy ()
 
new QAction Action (QWebPage.WebAction action)
 
 
new ulong BytesReceived ()
 
 
new QMenu CreateStandardContextMenu ()
 
 
new QWebFrame CurrentFrame ()
 
 
override bool OnEvent (QEvent arg1)
 
 
new bool extension (QWebPage.Extension extension)
 
 
new bool extension (QWebPage.Extension extension, QWebPage.ExtensionOption option=null)
 
 
virtual bool extension (QWebPage.Extension extension, QWebPage.ExtensionOption option=null, QWebPage.ExtensionReturn output=null)
 
 
new bool FindText (string subString, QWebPage.FindFlag options=0)
 
 
new bool FocusNextPrevChild (bool next)
 
 
new QWebFrame FrameAt (QPoint pos)
 
 
new QWebHistory History ()
 
 
new object InputMethodQuery (Qt.InputMethodQuery property)
 
 
new QWebFrame MainFrame ()
 
 
new void SetActualVisibleContentRect (QRect rect)
 
 
new void SetFeaturePermission (QWebFrame frame, QWebPage.Feature feature, QWebPage.PermissionPolicy policy)
 
 
new QWebSettings Settings ()
 
 
new bool ShouldInterruptJavaScript ()
 
 
new
System.Collections.Generic.List
< string > 
SupportedContentTypes ()
 
 
new bool SupportsContentType (string mimeType)
 
 
virtual bool SupportsExtension (QWebPage.Extension extension)
 
 
new bool OnSwallowContextMenuEvent (QContextMenuEvent @event)
 
 
new ulong TotalBytes ()
 
 
virtual void TriggerAction (QWebPage.WebAction action, bool @checked=false)
 
 
new QUndoStack UndoStack ()
 
 
new void UpdatePositionDependentActions (QPoint pos)
 
 
new QWebPage.ViewportAttributes ViewportAttributesForSize (QSize availableSize)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
 
 
new bool BlockSignals (bool b)
 
 
new
System.Collections.Generic.List
< QObject
Children ()
 
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
new void DeleteLater ()
 
 
new bool Disconnect (QObject receiver, string member=null)
 
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
 
 
new void DumpObjectInfo ()
 
 
new void DumpObjectTree ()
 
 
new
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames ()
 
 
virtual bool EventFilter (QObject arg1, QEvent arg2)
 
 
new bool Inherits (string classname)
 
 
new void InstallEventFilter (QObject arg1)
 
 
new bool IsWidgetType ()
 
 
new void KillTimer (int id)
 
 
new object Property (string name)
 
 
new void RemoveEventFilter (QObject arg1)
 
 
new bool SetProperty (string name, object value)
 
 
new void SetUserData (uint id, QObjectUserData data)
 
new bool SignalsBlocked ()
 
 
new int StartTimer (int interval)
 
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 

Static Public Member Functions

static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection)
 
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
 
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
 
 
static uint RegisterUserData ()
 
static string Tr (string s, string c=null)
 
 
static string Tr (string s, string c, int n)
 
 
static string TrUtf8 (string s, string c=null)
 
 
static string TrUtf8 (string s, string c, int n)
 
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream arg1, QSizeF arg2)
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream arg1, QPoint arg2)
 
static QDataStream Write (QDataStream arg1, QLineF arg2)
 
static QDataStream Write (QDataStream arg1, QPointF arg2)
 
static QDataStream Write (QDataStream arg1, QChar arg2)
 
static QDataStream Write (QDataStream arg1, QByteArray arg2)
 
static QDataStream Write (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Write (QDataStream arg1, QRectF arg2)
 
static QDataStream Write (QDataStream arg1, QDateTime arg2)
 
static QDataStream Write (QDataStream arg1, QUrl arg2)
 
static QDataStream Write (QDataStream arg1, QTime arg2)
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream arg1, QBitArray arg2)
 
static QDataStream Write (QDataStream arg1, QUuid arg2)
 
static QDataStream Write (QDataStream arg1, QLine arg2)
 
static QDataStream Write (QDataStream arg1, QDate arg2)
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
 
static QDataStream Write (QDataStream arg1, QRect arg2)
 
static QDataStream Write (QDataStream arg1, QSize arg2)
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
 
static QDataStream Read (QDataStream arg1, QChar arg2)
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream arg1, QRect arg2)
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream arg1, QDate arg2)
 
static QDataStream Read (QDataStream arg1, QUrl arg2)
 
static QDataStream Read (QDataStream arg1, QUuid arg2)
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream arg1, QLineF arg2)
 
static QDataStream Read (QDataStream arg1, QRectF arg2)
 
static QDataStream Read (QDataStream arg1, QPointF arg2)
 
static QDataStream Read (QDataStream arg1, QLine arg2)
 
static QDataStream Read (QDataStream arg1, QBitArray arg2)
 
static QDataStream Read (QDataStream arg1, QSize arg2)
 
static QDataStream Read (QDataStream arg1, QDateTime arg2)
 
static QDataStream Read (QDataStream arg1, QTime arg2)
 
static QDataStream Read (QDataStream arg1, QPoint arg2)
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream arg1, QByteArray arg2)
 
static QDataStream Read (QDataStream arg1, QSizeF arg2)
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
 
static double qAcos (double v)
 
static void qAddPostRoutine (System.Action arg1)
 
static string qAppName ()
 
static double qAsin (double v)
 
static double qAtan (double v)
 
static double qAtan2 (double x, double y)
 
static void qBadAlloc ()
 
static int qCeil (double v)
 
static ushort qChecksum (string s, uint len)
 
static QByteArray qCompress (QByteArray data)
 
static QByteArray qCompress (QByteArray data, int compressionLevel=-1)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
 
static double qCos (double v)
 
static double qExp (double v)
 
static double qFabs (double v)
 
static double qFastCos (double x)
 
static double qFastSin (double x)
 
static string qFlagLocation (string method)
 
static int qFloor (double v)
 
static bool qFuzzyCompare (double p1, double p2)
 
static bool qFuzzyCompare (float p1, float p2)
 
static bool qFuzzyIsNull (double d)
 
static bool qFuzzyIsNull (float f)
 
static uint qHash (QBitArray key)
 
static uint qHash (QChar key)
 
static uint qHash (QStringRef key)
 
static uint qHash (QUrl url)
 
static uint qHash (QPersistentModelIndex index)
 
static uint qHash (QByteArray key)
 
static uint qHash (QModelIndex index)
 
static uint qHash (uint key)
 
static uint qHash (sbyte key)
 
static uint qHash (byte key)
 
static uint qHash (short key)
 
static uint qHash (NativeLong key)
 
static uint qHash (ushort key)
 
static uint qHash (long key)
 
static uint qHash (ulong key)
 
static uint qHash (int key)
 
static uint qHash (string key)
 
static uint qHash (NativeULong key)
 
static double qInf ()
 
static Qt.ActionQtMsgTypeString qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1)
 
static int qIntCast (float f)
 
static int qIntCast (double f)
 
static bool qIsFinite (double d)
 
static bool qIsFinite (float f)
 
static bool qIsInf (float f)
 
static bool qIsInf (double d)
 
static bool qIsNaN (float f)
 
static bool qIsNaN (double d)
 
static bool qIsNull (float f)
 
static bool qIsNull (double d)
 
static double qLn (double v)
 
static double qPow (double x, double y)
 
static double qQNaN ()
 
static void qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
 
static void qRemovePostRoutine (System.Action arg1)
 
static int qRound (double d)
 
static long qRound64 (double d)
 
static double qSNaN ()
 
static bool qSharedBuild ()
 
static double qSin (double v)
 
static double qSqrt (double v)
 
static bool qStringComparisonHelper (QStringRef s1, string s2)
 
static double qTan (double v)
 
static QByteArray qUncompress (QByteArray data)
 
static QByteArray qUncompress (Pointer< byte > data, int nbytes)
 
static string qVersion ()
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
 
static bool Qputenv (string varName, QByteArray value)
 
static int Qrand ()
 
static void Qsrand (uint seed)
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
 
static Pointer< sbyte > Qstrdup (string arg1)
 
static int Qstricmp (string arg1, string arg2)
 
static uint Qstrlen (string str)
 
static int Qstrncmp (string str1, string str2, uint len)
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
 
static int Qstrnicmp (string arg1, string arg2, uint len)
 
static uint Qstrnlen (string str, uint maxlen)
 
static string QtTrId (string id, int n=-1)
 

Protected Member Functions

 QWebPage (System.Type dummy)
 
virtual bool AcceptNavigationRequest (QWebFrame frame, QNetworkRequest request, QWebPage.NavigationType type)
 
 
new void OnApplicationCacheQuotaExceeded (QWebSecurityOrigin origin, ulong defaultOriginQuota)
 
 
virtual string ChooseFile (QWebFrame originatingFrame, string oldFile)
 
 
new void OnContentsChanged ()
 
 
virtual QObject CreatePlugin (string classid, QUrl url, System.Collections.Generic.List< string > paramNames, System.Collections.Generic.List< string > paramValues)
 
 
virtual QWebPage CreateWindow (QWebPage.WebWindowType type)
 
 
new void OnDatabaseQuotaExceeded (QWebFrame frame, string databaseName)
 
 
new void OnDownloadRequested (QNetworkRequest request)
 
 
new void OnFeaturePermissionRequestCanceled (QWebFrame frame, QWebPage.Feature feature)
 
 
new void OnFeaturePermissionRequested (QWebFrame frame, QWebPage.Feature feature)
 
 
new void OnFrameCreated (QWebFrame frame)
 
 
new void OnGeometryChangeRequested (QRect geom)
 
 
virtual void JavaScriptAlert (QWebFrame originatingFrame, string msg)
 
 
virtual bool JavaScriptConfirm (QWebFrame originatingFrame, string msg)
 
 
virtual void JavaScriptConsoleMessage (string message, int lineNumber, string sourceID)
 
 
virtual bool JavaScriptPrompt (QWebFrame originatingFrame, string msg, string defaultValue, System.Text.StringBuilder result)
 
 
new void OnLinkClicked (QUrl url)
 
 
new void OnLinkHovered (string link, string title, string textContent)
 
 
new void OnLoadFinished (bool ok)
 
 
new void OnLoadProgress (int progress)
 
 
new void OnLoadStarted ()
 
 
new void OnMenuBarVisibilityChangeRequested (bool visible)
 
 
new void OnMicroFocusChanged ()
 
 
new void OnPrintRequested (QWebFrame frame)
 
 
new void OnRepaintRequested (QRect dirtyRect)
 
 
new void OnRestoreFrameStateRequested (QWebFrame frame)
 
 
new void OnSaveFrameStateRequested (QWebFrame frame, QWebHistoryItem item)
 
 
new void OnScrollRequested (int dx, int dy, QRect scrollViewRect)
 
 
new void OnSelectionChanged ()
 
 
new void OnStatusBarMessage (string text)
 
 
new void OnStatusBarVisibilityChangeRequested (bool visible)
 
 
new void OnToolBarVisibilityChangeRequested (bool visible)
 
 
new void OnUnsupportedContent (QNetworkReply reply)
 
 
virtual string UserAgentForUrl (QUrl url)
 
 
new void OnViewportChangeRequested ()
 
 
new void OnWindowCloseRequested ()
 
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent arg1)
 
 
virtual void ConnectNotify (string signal)
 
 
virtual void OnCustomEvent (QEvent arg1)
 
 
new void OnDestroyed (QObject arg1=null)
 
 
virtual void DisconnectNotify (string signal)
 
 
new int Receivers (string signal)
 
 
new QObject Sender ()
 
 
new int SenderSignalIndex ()
 
 
virtual void OnTimerEvent (QTimerEvent arg1)
 
 

Properties

virtual EventHandler
< QEventArgs
< QContextMenuEvent > > 
SwallowContextMenuEvent
 
 
Slot LoadStarted
 
 
Slot< System.Int32 > LoadProgress
 
 
Slot< System.Boolean > LoadFinished
 
 
Slot< System.String,
System.String, System.String > 
LinkHovered
 
 
Slot< System.String > StatusBarMessage
 
 
Slot SelectionChanged
 
 
Slot< QWebFrameFrameCreated
 
 
Slot< QRectGeometryChangeRequested
 
 
Slot< QRectRepaintRequested
 
 
Slot< System.Int32,
System.Int32, QRect
ScrollRequested
 
 
Slot WindowCloseRequested
 
 
Slot< QWebFramePrintRequested
 
 
Slot< QUrlLinkClicked
 
 
Slot< System.Boolean > ToolBarVisibilityChangeRequested
 
 
Slot< System.Boolean > StatusBarVisibilityChangeRequested
 
 
Slot< System.Boolean > MenuBarVisibilityChangeRequested
 
 
Slot< QNetworkReplyUnsupportedContent
 
 
Slot< QNetworkRequestDownloadRequested
 
 
Slot MicroFocusChanged
 
 
Slot ContentsChanged
 
 
Slot< QWebFrame, System.String > DatabaseQuotaExceeded
 
 
Slot< QWebSecurityOrigin,
System.UInt64 > 
ApplicationCacheQuotaExceeded
 
 
Slot< QWebFrame, QWebHistoryItemSaveFrameStateRequested
 
 
Slot< QWebFrameRestoreFrameStateRequested
 
 
Slot ViewportChangeRequested
 
 
Slot< QWebFrame, QWebPage.FeatureFeaturePermissionRequested
 
 
Slot< QWebFrame, QWebPage.FeatureFeaturePermissionRequestCanceled
 
 
new QNetworkAccessManager NetworkAccessManager [get, set]
 
 
new QWebPluginFactory PluginFactory [get, set]
 
 
new QWidget View [get, set]
 
 
new bool Modified [get]
 
 
new string SelectedText [get]
 
 
new string SelectedHtml [get]
 
 
new bool HasSelection [get]
 
 
new QSize ViewportSize [get, set]
 
 
new QSize PreferredContentsSize [get, set]
 
 
new bool ForwardUnsupportedContent [get, set]
 
 
new LinkDelegationPolicy linkDelegationPolicy [get, set]
 
 
new QPalette Palette [get, set]
 
 
new bool ContentEditable [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQWebPageSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
 
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
 
 
Slot< QObjectDestroyedQObject
 
Slot Destroyed
 
 
new QObject Parent [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 

Additional Inherited Members

- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

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

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 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 load(), setUrl() and 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.

Using QWebPage in a Widget-less Environment

Before you begin painting a QWebPage object, you need to set the size of the viewport by calling setViewportSize(). Then, you invoke the main frame's render function (QWebFrame::render()). An example of this is shown in the code snippet below.

Suppose we have a Thumbnail class as follows:

class Thumbnailer : public QObject

{

Q_OBJECT

public:

Thumbnailer(const QUrl &url);

signals:

void finished();

private slots:

void render();

private:

QWebPage page;

};

The Thumbnail's constructor takes in a url. We connect our QWebPage object's loadFinished() signal to our private slot, render().

Thumbnailer::Thumbnailer(const QUrl &url)

{

page.mainFrame()->load(url);

connect(&page, SIGNAL(loadFinished(bool)),

this, SLOT(render()));

}

The render() function shows how we can paint a thumbnail using a QWebPage object.

void Thumbnailer::render()

{

page.setViewportSize(page.mainFrame()->contentsSize());

QImage image(page.viewportSize(), QImage::Format_ARGB32);

QPainter painter(&image);

page.mainFrame()->render(&painter);

painter.end();

QImage thumbnail = image.scaled(400, 400);

thumbnail.save("thumbnail.png");

emit finished();

}

We begin by setting the viewportSize and then we instantiate a QImage object, image, with the same size as our viewportSize. This image is then sent as a parameter to painter. Next, we render the contents of the main frame and its subframes into painter. Finally, we save the scaled image.

See also QWebFrame.

Member Enumeration Documentation

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

This enum was introduced or modified in Qt 4.6.

Enumerator:
Http 

The error occurred in the HTTP layer; the error code is a HTTP status code (see QNetworkRequest::HttpStatusCodeAttribute).

QtNetwork 

The error occurred in the QtNetwork layer; the error code is of type QNetworkReply::NetworkError.

WebKit 

The error is an internal WebKit error.

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().

See also ChooseMultipleFilesExtensionOption, ChooseMultipleFilesExtensionReturn, ErrorPageExtensionOption, and ErrorPageExtensionReturn.

Enumerator:
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)

Enumerator:
Geolocation 
Notifications 

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

Enumerator:
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. (This value was introduced in 4.6.)

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

See also QWebPage::linkDelegationPolicy.

Enumerator:
DelegateAllLinks 

Whenever a link is activated the linkClicked() signal is emitted.

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.

DontDelegateLinks 

No links are delegated. Instead, QWebPage tries to handle them all.

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

See also acceptNavigationRequest().

Enumerator:
NavigationTypeBackOrForward 

Navigation to a previously shown document in the back or forward history is requested.

NavigationTypeFormResubmitted 

An HTML form was submitted a second time.

NavigationTypeFormSubmitted 

The user activated a submit button for an HTML form.

NavigationTypeLinkClicked 

The user clicked on a link or pressed return on a focused link.

NavigationTypeOther 

A navigation to another document using a method not listed above.

NavigationTypeReload 

The user activated the reload action.

Enumerator:
PermissionDeniedByUser 
PermissionGrantedByUser 
PermissionUnknown 

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

Enumerator:
AlignCenter 

Applies center alignment to content.

AlignJustified 

Applies full justification to content.

AlignLeft 

Applies left justification to content.

AlignRight 

Applies right justification to content.

Back 

Navigate back in the history of navigated links.

Copy 

Copy the content currently selected into the clipboard.

CopyImageToClipboard 

Copy the highlighted image to the clipboard.

CopyImageUrlToClipboard 

Copy the highlighted image's URL to the clipboard.

CopyLinkToClipboard 

Copy the current link to the clipboard.

Cut 

Cut the content currently selected into the clipboard.

DeleteEndOfWord 

Delete to the end of the word.

DeleteStartOfWord 

Delete to the start of the word.

DownloadImageToDisk 

Download the highlighted image to the disk.

DownloadLinkToDisk 

Download the current link to the disk.

Forward 

Navigate forward in the history of navigated links.

Indent 

Increases the indentation of the currently selected format block by one increment.

InsertLineSeparator 

Insert a new line.

InsertOrderedList 

Toggles the selection between an ordered list and a normal block.

InsertParagraphSeparator 

Insert a new paragraph.

InsertUnorderedList 

Toggles the selection between an ordered list and a normal block.

InspectElement 

Show the Web Inspector with the currently highlighted HTML element.

MoveToEndOfBlock 

Move the cursor to the end of the block.

MoveToEndOfDocument 

Move the cursor to the end of the document.

MoveToEndOfLine 

Move the cursor to the end of the line.

MoveToNextChar 

Move the cursor to the next character.

MoveToNextLine 

Move the cursor to the next line.

MoveToNextWord 

Move the cursor to the next word.

MoveToPreviousChar 

Move the cursor to the previous character.

MoveToPreviousLine 

Move the cursor to the previous line.

MoveToPreviousWord 

Move the cursor to the previous word.

MoveToStartOfBlock 

Move the cursor to the start of the block.

MoveToStartOfDocument 

Move the cursor to the start of the document.

MoveToStartOfLine 

Move the cursor to the start of the line.

NoWebAction 

No action is triggered.

OpenFrameInNewWindow 

Replicate the current frame in a new window.

OpenImageInNewWindow 

Open the highlighted image in a new window.

OpenLink 

Open the current link.

OpenLinkInNewWindow 

Open the current link in a new window.

Outdent 

Decreases the indentation of the currently selected format block by one increment.

Paste 

Paste content from the clipboard.

PasteAndMatchStyle 

Paste content from the clipboard with current style.

Redo 

Redo the last editing action.

Reload 

Reload the current page.

ReloadAndBypassCache 

Reload the current page, but do not use any local cache. (Added in Qt 4.6)

RemoveFormat 

Removes formatting and style.

SelectAll 

Selects all content.

SelectEndOfBlock 

Select to the end of the block.

SelectEndOfDocument 

Select to the end of the document.

SelectEndOfLine 

Select to the end of the line.

SelectNextChar 

Select to the next character.

SelectNextLine 

Select to the next line.

SelectNextWord 

Select to the next word.

SelectPreviousChar 

Select to the previous character.

SelectPreviousLine 

Select to the previous line.

SelectPreviousWord 

Select to the previous word.

SelectStartOfBlock 

Select to the start of the block.

SelectStartOfDocument 

Select to the start of the document.

SelectStartOfLine 

Select to the start of the line.

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.

Stop 

Stop loading the current page.

StopScheduledPageRefresh 

Stop all pending page refresh/redirect requests.

ToggleBold 

Toggle the formatting between bold and normal weight.

ToggleItalic 

Toggle the formatting between italic and normal 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.

ToggleUnderline 

Toggle underlining.

Undo 

Undo the last editing action.

WebActionCount 

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

Enumerator:
WebBrowserWindow 

The window is a regular web browser window.

WebModalDialog 

The window acts as modal dialog.

Constructor & Destructor Documentation

QtWebKit.QWebPage.QWebPage ( System.Type  dummy)
protected
QtWebKit.QWebPage.QWebPage ( QObject  parent = null)

Constructs an empty QWebPage with parent parent.

Member Function Documentation

virtual bool QtWebKit.QWebPage.AcceptNavigationRequest ( QWebFrame  frame,
QNetworkRequest  request,
QWebPage.NavigationType  type 
)
protectedvirtual

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().

new QAction QtWebKit.QWebPage.Action ( QWebPage.WebAction  action)

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().

new ulong QtWebKit.QWebPage.BytesReceived ( )

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

See also totalBytes() and loadProgress().

virtual string QtWebKit.QWebPage.ChooseFile ( QWebFrame  originatingFrame,
string  oldFile 
)
protectedvirtual

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.

virtual QObject QtWebKit.QWebPage.CreatePlugin ( string  classid,
QUrl  url,
System.Collections.Generic.List< string >  paramNames,
System.Collections.Generic.List< string >  paramValues 
)
protectedvirtual

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.

override void QtWebKit.QWebPage.CreateProxy ( )
virtual

Reimplemented from QtCore.QObject.

new QMenu QtWebKit.QWebPage.CreateStandardContextMenu ( )

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.

This function was introduced in Qt 4.5.

virtual QWebPage QtWebKit.QWebPage.CreateWindow ( QWebPage.WebWindowType  type)
protectedvirtual

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() and QWebView::createWindow().

new QWebFrame QtWebKit.QWebPage.CurrentFrame ( )

Returns the frame currently active.

See also mainFrame() and frameCreated().

new void QtWebKit.QWebPage.Dispose ( )
new bool QtWebKit.QWebPage.extension ( QWebPage.Extension  extension)

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() and Extension.

new bool QtWebKit.QWebPage.extension ( QWebPage.Extension  extension,
QWebPage.ExtensionOption  option = null 
)

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() and Extension.

virtual bool QtWebKit.QWebPage.extension ( QWebPage.Extension  extension,
QWebPage.ExtensionOption  option = null,
QWebPage.ExtensionReturn  output = null 
)
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() and Extension.

new bool QtWebKit.QWebPage.FindText ( string  subString,
QWebPage.FindFlag  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.

new bool QtWebKit.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.

new QWebFrame QtWebKit.QWebPage.FrameAt ( QPoint  pos)

Returns the frame at the given point pos, or 0 if there is no frame at that position.

This function was introduced in Qt 4.6.

See also mainFrame() and currentFrame().

new QWebHistory QtWebKit.QWebPage.History ( )

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

new object QtWebKit.QWebPage.InputMethodQuery ( Qt.InputMethodQuery  property)

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, and QInputContext.

virtual void QtWebKit.QWebPage.JavaScriptAlert ( QWebFrame  originatingFrame,
string  msg 
)
protectedvirtual

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.

virtual bool QtWebKit.QWebPage.JavaScriptConfirm ( QWebFrame  originatingFrame,
string  msg 
)
protectedvirtual

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.

virtual void QtWebKit.QWebPage.JavaScriptConsoleMessage ( string  message,
int  lineNumber,
string  sourceID 
)
protectedvirtual

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.

virtual bool QtWebKit.QWebPage.JavaScriptPrompt ( QWebFrame  originatingFrame,
string  msg,
string  defaultValue,
System.Text.StringBuilder  result 
)
protectedvirtual

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().

new QWebFrame QtWebKit.QWebPage.MainFrame ( )

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().

new void QtWebKit.QWebPage.OnApplicationCacheQuotaExceeded ( QWebSecurityOrigin  origin,
ulong  defaultOriginQuota 
)
protected

This signal is emitted whenever the web site is asking to store data to the application cache database databaseName and the quota allocated to that web site is exceeded.

new void QtWebKit.QWebPage.OnContentsChanged ( )
protected

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

This function was introduced in Qt 4.5.

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

new void QtWebKit.QWebPage.OnDatabaseQuotaExceeded ( QWebFrame  frame,
string  databaseName 
)
protected

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.

This function was introduced in Qt 4.5.

See also QWebDatabase.

new void QtWebKit.QWebPage.OnDownloadRequested ( QNetworkRequest  request)
protected

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().

override bool QtWebKit.QWebPage.OnEvent ( QEvent  arg1)
virtual

Reimplemented from QObject::event().

Reimplemented from QtCore.QObject.

new void QtWebKit.QWebPage.OnFeaturePermissionRequestCanceled ( QWebFrame  frame,
QWebPage.Feature  feature 
)
protected

void QWebPage::featurePermissionRequested ( QWebFrame * frame, QWebPage::Feature feature ) [signal]

new void QtWebKit.QWebPage.OnFeaturePermissionRequested ( QWebFrame  frame,
QWebPage.Feature  feature 
)
protected

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.

new void QtWebKit.QWebPage.OnFrameCreated ( QWebFrame  frame)
protected

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

See also currentFrame().

new void QtWebKit.QWebPage.OnGeometryChangeRequested ( QRect  geom)
protected

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.

new void QtWebKit.QWebPage.OnLinkClicked ( QUrl  url)
protected

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().

new void QtWebKit.QWebPage.OnLinkHovered ( string  link,
string  title,
string  textContent 
)
protected

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().

new void QtWebKit.QWebPage.OnLoadFinished ( bool  ok)
protected

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() and ErrorPageExtension.

new void QtWebKit.QWebPage.OnLoadProgress ( int  progress)
protected

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().

new void QtWebKit.QWebPage.OnLoadStarted ( )
protected

This signal is emitted when a page starts loading content.

See also loadFinished().

new void QtWebKit.QWebPage.OnMenuBarVisibilityChangeRequested ( bool  visible)
protected

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

new void QtWebKit.QWebPage.OnMicroFocusChanged ( )
protected

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.

new void QtWebKit.QWebPage.OnPrintRequested ( QWebFrame  frame)
protected

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() and QPrintPreviewDialog.

new void QtWebKit.QWebPage.OnRepaintRequested ( QRect  dirtyRect)
protected

This signal is emitted whenever this QWebPage should be updated. It's useful when rendering a QWebPage without a QWebView or QGraphicsWebView. 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() and view().

new void QtWebKit.QWebPage.OnRestoreFrameStateRequested ( QWebFrame  frame)
protected

This signal is emitted when the load of frame is finished and the application may now update its state accordingly.

This function was introduced in Qt 4.5.

new void QtWebKit.QWebPage.OnSaveFrameStateRequested ( QWebFrame  frame,
QWebHistoryItem  item 
)
protected

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().

This function was introduced in Qt 4.5.

new void QtWebKit.QWebPage.OnScrollRequested ( int  dx,
int  dy,
QRect  scrollViewRect 
)
protected

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().

new void QtWebKit.QWebPage.OnSelectionChanged ( )
protected

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

See also selectedText().

new void QtWebKit.QWebPage.OnStatusBarMessage ( string  text)
protected

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

new void QtWebKit.QWebPage.OnStatusBarVisibilityChangeRequested ( bool  visible)
protected

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

new bool QtWebKit.QWebPage.OnSwallowContextMenuEvent ( 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 Google Maps, for example.

new void QtWebKit.QWebPage.OnToolBarVisibilityChangeRequested ( bool  visible)
protected

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

new void QtWebKit.QWebPage.OnUnsupportedContent ( QNetworkReply  reply)
protected

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: The receiving slot is responsible for deleting the QNetworkReply reply.

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

See also downloadRequested().

new void QtWebKit.QWebPage.OnViewportChangeRequested ( )
protected

Page authors can provide the supplied values by using the viewport meta tag. More information about this can be found at Safari Reference Library: Using the Viewport Meta Tag.

This function was introduced in Qt 4.8.

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

new void QtWebKit.QWebPage.OnWindowCloseRequested ( )
protected

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

new void QtWebKit.QWebPage.SetActualVisibleContentRect ( QRect  rect)

void QWebPage::setFeaturePermission ( QWebFrame * frame, Feature feature, PermissionPolicy policy )

new void QtWebKit.QWebPage.SetFeaturePermission ( QWebFrame  frame,
QWebPage.Feature  feature,
QWebPage.PermissionPolicy  policy 
)

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().

new QWebSettings QtWebKit.QWebPage.Settings ( )

Returns a pointer to the page's settings object.

See also QWebSettings::globalSettings().

new bool QtWebKit.QWebPage.ShouldInterruptJavaScript ( )

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.

This function was introduced in Qt 4.6.

new System.Collections.Generic.List<string> QtWebKit.QWebPage.SupportedContentTypes ( )

Returns the list of all content types supported by QWebPage.

new bool QtWebKit.QWebPage.SupportsContentType ( string  mimeType)

Returns true if QWebPage can handle the given mimeType; otherwise, returns false.

virtual bool QtWebKit.QWebPage.SupportsExtension ( QWebPage.Extension  extension)
virtual

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

See also extension().

new ulong QtWebKit.QWebPage.TotalBytes ( )

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().

static string QtWebKit.QWebPage.Tr ( string  s,
string  c = null 
)
static
static string QtWebKit.QWebPage.Tr ( string  s,
string  c,
int  n 
)
static
virtual void QtWebKit.QWebPage.TriggerAction ( QWebPage.WebAction  action,
bool @  checked = 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().

static string QtWebKit.QWebPage.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtWebKit.QWebPage.TrUtf8 ( string  s,
string  c,
int  n 
)
static
new QUndoStack QtWebKit.QWebPage.UndoStack ( )

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

See also modified.

new void QtWebKit.QWebPage.UpdatePositionDependentActions ( 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.

virtual string QtWebKit.QWebPage.UserAgentForUrl ( QUrl  url)
protectedvirtual

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%) 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% expands to the windowing system followed by "; " if it is not Windows (e.g. "X11; ").

Security% expands to "N; " if SSL is disabled.

Subplatform% expands to the operating system version (e.g. "Windows NT 6.1" or "Intel Mac OS X 10.5").

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.

new QWebPage.ViewportAttributes QtWebKit.QWebPage.ViewportAttributesForSize ( QSize  availableSize)

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.

The ViewportAttributes includes a pixel density ratio, which will also be exposed to the web author though the -webkit-pixel-ratio media feature. This is the ratio between 1 density-independent pixel (DPI) and physical pixels.

A density-independent pixel is equivalent to one physical pixel on a 160 DPI screen, so on our platform assumes that as the baseline density.

The conversion of DIP units to screen pixels is quite simple:

pixels = DIPs * (density / 160).

Thus, on a 240 DPI screen, 1 DIPs would equal 1.5 physical pixels.

An invalid instance will be returned in the case an empty size is passed to the method.

Note: The density is automatically obtained from the DPI of the screen where the page is being shown, but as many X11 servers are reporting wrong DPI, it is possible to override it using QX11Info::setAppDpiY().

Property Documentation

Slot<QWebSecurityOrigin,System.UInt64> QtWebKit.QWebPage.ApplicationCacheQuotaExceeded
addremove

This signal is emitted whenever the web site is asking to store data to the application cache database databaseName and the quota allocated to that web site is exceeded.

new bool QtWebKit.QWebPage.ContentEditable
getset

This property holds whether the content in this QWebPage is editable or not.

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.

This property was introduced in Qt 4.5.

Slot QtWebKit.QWebPage.ContentsChanged
addremove

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

This function was introduced in Qt 4.5.

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

Slot<QWebFrame,System.String> QtWebKit.QWebPage.DatabaseQuotaExceeded
addremove

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.

This function was introduced in Qt 4.5.

See also QWebDatabase.

Slot<QNetworkRequest> QtWebKit.QWebPage.DownloadRequested
addremove

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().

new IQWebPageSignals QtWebKit.QWebPage.Emit
getprotected
Slot<QWebFrame,QWebPage.Feature> QtWebKit.QWebPage.FeaturePermissionRequestCanceled
addremove

void QWebPage::featurePermissionRequested ( QWebFrame * frame, QWebPage::Feature feature ) [signal]

Slot<QWebFrame,QWebPage.Feature> QtWebKit.QWebPage.FeaturePermissionRequested
addremove

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.

new bool QtWebKit.QWebPage.ForwardUnsupportedContent
getset

This property holds 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.

Slot<QWebFrame> QtWebKit.QWebPage.FrameCreated
addremove

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

See also currentFrame().

Slot<QRect> QtWebKit.QWebPage.GeometryChangeRequested
addremove

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.

new bool QtWebKit.QWebPage.HasSelection
get

This property holds whether this page contains selected content or not.

Slot<QUrl> QtWebKit.QWebPage.LinkClicked
addremove

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().

new LinkDelegationPolicy QtWebKit.QWebPage.linkDelegationPolicy
getset

This property holds how QWebPage should delegate the handling of links through the linkClicked() signal.

The default is to delegate no links.

Slot<System.String,System.String,System.String> QtWebKit.QWebPage.LinkHovered
addremove

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().

Slot<System.Boolean> QtWebKit.QWebPage.LoadFinished
addremove

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() and ErrorPageExtension.

Slot<System.Int32> QtWebKit.QWebPage.LoadProgress
addremove

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().

Slot QtWebKit.QWebPage.LoadStarted
addremove

This signal is emitted when a page starts loading content.

See also loadFinished().

Slot<System.Boolean> QtWebKit.QWebPage.MenuBarVisibilityChangeRequested
addremove

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

Slot QtWebKit.QWebPage.MicroFocusChanged
addremove

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.

new bool QtWebKit.QWebPage.Modified
get

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

By default, this property is false.

new QNetworkAccessManager QtWebKit.QWebPage.NetworkAccessManager
getset

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

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.

new QPalette QtWebKit.QWebPage.Palette
getset

This property holds 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.

new QWebPluginFactory QtWebKit.QWebPage.PluginFactory
getset

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

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.

new QSize QtWebKit.QWebPage.PreferredContentsSize
getset

This property holds a custom size used for laying out the page contents.

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.

This property was introduced in Qt 4.6.

Slot<QWebFrame> QtWebKit.QWebPage.PrintRequested
addremove

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() and QPrintPreviewDialog.

Slot<QRect> QtWebKit.QWebPage.RepaintRequested
addremove

This signal is emitted whenever this QWebPage should be updated. It's useful when rendering a QWebPage without a QWebView or QGraphicsWebView. 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() and view().

Slot<QWebFrame> QtWebKit.QWebPage.RestoreFrameStateRequested
addremove

This signal is emitted when the load of frame is finished and the application may now update its state accordingly.

This function was introduced in Qt 4.5.

Slot<QWebFrame,QWebHistoryItem> QtWebKit.QWebPage.SaveFrameStateRequested
addremove

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().

This function was introduced in Qt 4.5.

Slot<System.Int32,System.Int32,QRect> QtWebKit.QWebPage.ScrollRequested
addremove

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().

new string QtWebKit.QWebPage.SelectedHtml
get

This property holds the HTML currently selected.

By default, this property contains an empty string.

This property was introduced in Qt 4.8.

new string QtWebKit.QWebPage.SelectedText
get

This property holds the text currently selected.

By default, this property contains an empty string.

Slot QtWebKit.QWebPage.SelectionChanged
addremove

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

See also selectedText().

new QMetaObject QtWebKit.QWebPage.StaticMetaObject
staticget
Slot<System.String> QtWebKit.QWebPage.StatusBarMessage
addremove

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

Slot<System.Boolean> QtWebKit.QWebPage.StatusBarVisibilityChangeRequested
addremove

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

virtual EventHandler<QEventArgs<QContextMenuEvent> > QtWebKit.QWebPage.SwallowContextMenuEvent
addremove

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 Google Maps, for example.

Slot<System.Boolean> QtWebKit.QWebPage.ToolBarVisibilityChangeRequested
addremove

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

Slot<QNetworkReply> QtWebKit.QWebPage.UnsupportedContent
addremove

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: The receiving slot is responsible for deleting the QNetworkReply reply.

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

See also downloadRequested().

new QWidget QtWebKit.QWebPage.View
getset

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

Sets the view that is associated with the web page.

Slot QtWebKit.QWebPage.ViewportChangeRequested
addremove

Page authors can provide the supplied values by using the viewport meta tag. More information about this can be found at Safari Reference Library: Using the Viewport Meta Tag.

This function was introduced in Qt 4.8.

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

new QSize QtWebKit.QWebPage.ViewportSize
getset

This property holds 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.

Slot QtWebKit.QWebPage.WindowCloseRequested
addremove

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