![]() |
Home · All Classes · Main Classes · Grouped Classes · Modules · Functions | ![]() |
The QWebView class provides a widget that is used to view and edit web documents. More...
#include <QWebView>
Inherits QWidget.
This class was introduced in Qt 4.4.
|
|
The QWebView class provides a widget that is used to view and edit web documents.
QWebView is the main widget component of the QtWebKit web browsing module. It can be used in various applications to display web content live from the Internet.
The image below shows QWebView previewed in Qt Designer with the Trolltech website.
A web site can be loaded onto QWebView with the load() function. Like all Qt Widgets, the show() function must be invoked in order to display QWebView. The snippet below illustrates this:
QWebView *view = new QWebView(parent);
view->load(QUrl("http://www.trolltech.com/"));
view->show();
Alternatively, setUrl() can also be used to load a web site. The loadFinished() signal is emitted by QWebView when a frame has loaded completely.
QWebView consists of other objects such as QWebFrame and QWebPage. The flowchart below shows these elements are related.
Note: It is possible to use QWebPage and QWebFrame, without using QWebView, if you do not require QWidget attributes.
This property holds the icon associated with the web page currently viewed.
Access functions:
This property holds whether the document was modified by the user.
Parts of HTML documents can be editable for example through the contenteditable attribute on HTML elements.
Access functions:
This property holds the text currently selected.
Access functions:
This property holds the scaling factor for all text in the frame.
Access functions:
This property holds the title of the web page currently viewed.
Access functions:
This property holds the url of the web page currently viewed.
Setting this property clears the view and loads the url.
Access functions:
Constructs an empty QWebView with parent parent.
Destroys the web view.
Convenience slot that loads the previous document in the list of documents built by navigating links. Does nothing if there is no previous document.
It is equivalent to
view->page()->triggerAction(QWebPage::GoBack);
This function is called whenever WebKit wants to create a new window of the given type, for example as a result of a JavaScript request to open a document in a new window.
Finds the next occurrence of the string, subString, in the page, using the given options. Returns true of subString was found and selects the match visually; otherwise returns false.
Convenience slot that loads the next document in the list of documents built by navigating links. Does nothing if there is no next document.
It is equivalent to
view->page()->triggerAction(QWebPage::GoForward);
Returns a pointer to the view's history of navigated web pages.
It is equivalent to
view->page()->history();
This signal is emitted whenever the icon of the page is loaded or changes.
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.
See also QWebPage::linkDelegationPolicy().
Loads the specified url and displays it.
Note: The view remains the same until enough data has arrived to display the new url.
This is an overloaded member function, provided for convenience.
Loads a network request, request, using the method specified in operation.
body is optional and is only used for POST operations.
Note: The view remains the same until enough data has arrived to display the new url.
This signal is emitted when a load of the frame is finished.
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.
This signal is emitted when a new load of the frame is started.
Returns a pointer to the underlying web page.
See also setPage().
Returns a pointer to a QAction that encapsulates the specified web action action.
Prints the main frame to the given printer.
Reloads the current document.
This signal is emitted whenever the selection changes.
Sets the content of the web view to the specified content data. If the mimeType argument is empty it is currently assumed that the content is HTML but in future versions we may introduce auto-detection.
External objects referenced in the content are located relative to baseUrl.
Sets the content of the web view to the specified html.
External objects referenced in the HTML document are located relative to baseUrl.
When using this method WebKit assumes that external resources such as JavaScript programs or style sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external script can be specified through the charset attribute of the HTML script tag. It is also possible for the encoding to be specified by web server.
This is an overloaded member function, provided for convenience.
Sets the content of the web view to the specified html.
External objects referenced in the HTML document are located relative to baseUrl.
Makes page the new web page of the web view.
The parent QObject of the provided page remains the owner of the object. If the current document is a child of the web view, it will be deleted.
See also page().
Returns a pointer to the view/page specific settings object.
It is equivalent to
view->page()->settings();
This signal is emitted when the statusbar text is changed by the page.
Convenience slot that stops loading the document.
It is equivalent to
view->page()->triggerAction(QWebPage::Stop);
This signal is emitted whenever the title of the main frame changes.
See also title().
Triggers the specified action. If it is a checkable action the specified checked state is assumed.
The following example triggers the copy action and therefore copies any selected text to the clipboard.
view->triggerAction(QWebPage::Copy);
This signal is emitted whenever the url of the main frame changes.
See also url().
Copyright © 2008 Trolltech | Trademarks | Qt 4.4.0-rc1 |