|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QWebView Class Reference

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.

- List of all members, including inherited members

### Properties

icon : const QPixmap modified : const bool selectedText : const QString | textInteractionFlags : Qt::TextInteractionFlags title : const QString url : QUrl

- 57 properties inherited from QWidget
- 1 property inherited from QObject

### Public Functions

- QWebView ( QWidget * parent = 0 )
- virtual ~QWebView ()
- QAction * action ( QWebPage::WebAction action ) const
- QWebHistory * history () const
- QPixmap icon () const
- bool isModified () const
- void load ( const QUrl & url )
- void load ( const QWebNetworkRequest & request )
- QWebPage * page () const
- QString selectedText () const
- void setContent ( const QByteArray & data, const QString & mimeType = QString(), const QUrl & baseUrl = QUrl() )
- void setHtml ( const QString & html, const QUrl & baseUrl = QUrl() )
- void setHtml ( const QByteArray & html, const QUrl & baseUrl = QUrl() )
- void setPage ( QWebPage * page )
- void setTextInteractionFlags ( Qt::TextInteractionFlags flags )
- QWebSettings * settings () const
- Qt::TextInteractionFlags textInteractionFlags () const
- QString title () const
- void triggerAction ( QWebPage::WebAction action, bool checked = false )
- QUrl url () const

- 206 public functions inherited from QWidget
- 29 public functions inherited from QObject
- 12 public functions inherited from QPaintDevice

### Public Slots

- void backward ()
- void forward ()
- void reload ()
- void stop ()

- 19 public slots inherited from QWidget
- 1 public slot inherited from QObject

### Signals

- void iconLoaded ()
- void linkClicked ( const QUrl & url )
- void loadFinished ()
- void loadProgressChanged ( int progress )
- void loadStarted ()
- void selectionChanged ()
- void statusBarTextChanged ( const QString & text )
- void titleChanged ( const QString & title )
- void urlChanged ( const QUrl & url )

- 1 signal inherited from QWidget
- 1 signal inherited from QObject

### Protected Functions

- virtual QWebView * createWindow ()

- 38 protected functions inherited from QWidget
- 7 protected functions inherited from QObject
- 1 protected function inherited from QPaintDevice

### Additional Inherited Members

- 4 static public members inherited from QWidget
- 5 static public members inherited from QObject
- 1 protected slot inherited from QWidget

## Detailed Description

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.

## Property Documentation

### icon : const QPixmap

This property holds the icon associated with the web page currently viewed.

Access functions:

- QPixmap icon () const

### modified : const bool

This property holds indicates whether the document was modified by the user or not.

Parts of HTML documents can be editable for example through the `contenteditable` attribute on HTML elements.

Access functions:

- bool isModified () const

### selectedText : const QString

This property holds the text currently selected.

Access functions:

- QString selectedText () const

### textInteractionFlags : Qt::TextInteractionFlags

Specifies how the view should interact with user input.

Access functions:

- Qt::TextInteractionFlags textInteractionFlags () const
- void setTextInteractionFlags ( Qt::TextInteractionFlags flags )

### title : const QString

This property holds the title of the web page currently viewed.

Access functions:

- QString title () const

### url : QUrl

This property holds the url of the web page currently viewed.

Access functions:

- QUrl url () const
- void load ( const QUrl & url )
- void load ( const QWebNetworkRequest & request )

## Member Function Documentation

### QWebView::QWebView ( QWidget * parent = 0 )

Constructs an empty QWebView with parent parent.

### QWebView::~QWebView () `[virtual]`

Destructor.

### QAction * QWebView::action ( QWebPage::WebAction action ) const

Returns a pointer to a QAction that encapsulates the specified web action action.

### void QWebView::backward () `[slot]`

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);

### QWebView * QWebView::createWindow () `[virtual protected]`

This function is called whenever WebKit wants to create a new window, for example as a result of a JavaScript request to open a document in a new window.

### void QWebView::forward () `[slot]`

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);

### QWebHistory * QWebView::history () const

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

It is equivalent to

     view->page()->history();

### void QWebView::iconLoaded () `[signal]`

This signal is emitted whenever the icon of the page is loaded or changes.

### void QWebView::linkClicked ( const QUrl & url ) `[signal]`

### void QWebView::loadFinished () `[signal]`

This signal is emitted when a load of the frame is finished.

### void QWebView::loadProgressChanged ( int progress ) `[signal]`

This signal is emitted when the global progress status changes. The current value is provided by progress in percent. It accumulates changes from all the child frames.

### void QWebView::loadStarted () `[signal]`

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

### QWebPage * QWebView::page () const

Returns a pointer to the underlying web page.

See also setPage().

### void QWebView::reload () `[slot]`

Reloads the current document.

### void QWebView::selectionChanged () `[signal]`

This signal is emitted whenever the selection changes.

### void QWebView::setContent ( const QByteArray & data, const QString & mimeType = QString(), const QUrl & baseUrl = QUrl() )

Sets the content of the web view to the specified content data. If the mimeType argument is empty it is assumed that the content is HTML.

External objects referenced in the HTML document are located relative to baseUrl.

### void QWebView::setHtml ( const QString & html, const QUrl & baseUrl = QUrl() )

Sets the content of the web view to the specified html.

External objects referenced in the HTML document are located relative to baseUrl.

### void QWebView::setHtml ( const QByteArray & html, const QUrl & baseUrl = QUrl() )

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.

### void QWebView::setPage ( QWebPage * page )

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, then it is deleted.

See also page().

### QWebSettings * QWebView::settings () const

Returns a pointer to the view/page specific settings object.

It is equivalent to

     view->page()->settings();

### void QWebView::statusBarTextChanged ( const QString & text ) `[signal]`

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

### void QWebView::stop () `[slot]`

Convenience slot that stops loading the document.

It is equivalent to

     view->page()->triggerAction(QWebPage::Stop);

### void QWebView::titleChanged ( const QString & title ) `[signal]`

This signal is emitted whenever the title of the frame changes.

See also title().

### void QWebView::triggerAction ( QWebPage::WebAction action, bool checked = false )

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);

### void QWebView::urlChanged ( const QUrl & url ) `[signal]`

This signal is emitted whenever the url of the main frame changes.

See also url().