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

# QWebFrame Class Reference

The QWebFrame class represents a frame in a web page. More...

     #include <QWebFrame>

Inherits QObject.

This class was introduced in Qt 4.4.

- List of all members, including inherited members

### Properties

- horizontalScrollBarPolicy : Qt::ScrollBarPolicy
- verticalScrollBarPolicy : Qt::ScrollBarPolicy

- 1 property inherited from QObject

### Public Functions

- void addToJSWindowObject ( const QString & name, QObject * object )
- QList<QWebFrame *> childFrames () const
- QRect geometry () const
- Qt::ScrollBarPolicy horizontalScrollBarPolicy () const
- QPixmap icon () const
- QString innerText () const
- void layout ()
- void load ( const QUrl & url )
- void load ( const QWebNetworkRequest & req )
- QString markup () const
- QString name () const
- QWebPage * page () const
- QWebFrame * parentFrame () const
- QPoint pos () const
- void render ( QPainter * painter, const QRegion & clip )
- QString renderTreeDump () const
- void setContent ( const QByteArray & data, const QString & mimeType = QString(), const QUrl & baseUrl = QUrl() )
- void setHorizontalScrollBarPolicy ( Qt::ScrollBarPolicy )
- void setHtml ( const QString & html, const QUrl & baseUrl = QUrl() )
- void setHtml ( const QByteArray & html, const QUrl & baseUrl = QUrl() )
- void setVerticalScrollBarPolicy ( Qt::ScrollBarPolicy )
- QString title () const
- QUrl url () const
- Qt::ScrollBarPolicy verticalScrollBarPolicy () const

- 29 public functions inherited from QObject

### Public Slots

- QString evaluateJavaScript ( const QString & scriptSource )

- 1 public slot inherited from QObject

### Signals

- void cleared ()
- void hoveringOverLink ( const QString & link, const QString & title, const QString & textContent )
- void iconLoaded ()
- void initialLayoutComplete ()
- void loadDone ( bool ok )
- void loadFinished ()
- void loadStarted ()
- void titleChanged ( const QString & title )
- void urlChanged ( const QUrl & url )

- 1 signal inherited from QObject

### Additional Inherited Members

- 5 static public members inherited from QObject
- 7 protected functions inherited from QObject

## Detailed Description

The QWebFrame class represents a frame in a web page.

QWebFrame represents a frame inside a web page. Each QWebPage object contains at least one frame, the mainFrame(). Additional frames will be created for HTML &lt;frame&gt; or &lt;iframe&gt; elements.

QWebFrame objects are created and controlled by the web page. You can connect to the web pages frameCreated() signal to find out about creation of new frames.

See also QWebPage.

## Property Documentation

### horizontalScrollBarPolicy : Qt::ScrollBarPolicy

This property defines the horizontal scrollbar policy.

Access functions:

- Qt::ScrollBarPolicy horizontalScrollBarPolicy () const
- void setHorizontalScrollBarPolicy ( Qt::ScrollBarPolicy )

See also Qt::ScrollBarPolicy.

### verticalScrollBarPolicy : Qt::ScrollBarPolicy

This property defines the vertical scrollbar policy.

Access functions:

- Qt::ScrollBarPolicy verticalScrollBarPolicy () const
- void setVerticalScrollBarPolicy ( Qt::ScrollBarPolicy )

See also Qt::ScrollBarPolicy.

## Member Function Documentation

### void QWebFrame::addToJSWindowObject ( const QString & name, QObject * object )

Make object available under name from within the frames JavaScript context. The object will be inserted as a child of the frames window object.

Qt properties will be exposed as JavaScript properties and slots as JavaScript methods.

### QList<QWebFrame *> QWebFrame::childFrames () const

Returns a list of all frames that are direct children of this frame.

### void QWebFrame::cleared () `[signal]`

This signal is emitted whenever the content of the frame is cleared (e.g. before starting a new load).

### QString QWebFrame::evaluateJavaScript ( const QString & scriptSource ) `[slot]`

Evaluate JavaScript defined by scriptSource using this frame as context.

### QRect QWebFrame::geometry () const

return the geometry of the frame relative to it's parent frame.

### void QWebFrame::hoveringOverLink ( const QString & link, const QString & title, const QString & textContent ) `[signal]`

This signal is emitted whenever the mouse cursor is hovering over a link. It can be used to display information about the link in e.g. the status bar. The signal arguments consist of the link destination, the title and the link text as textContent .

### QPixmap QWebFrame::icon () const

The icon associated with this frame.

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

This signal is emitted when the icon ("favicon") associated with the frame has been loaded.

### void QWebFrame::initialLayoutComplete () `[signal]`

This signal is emitted when the first (initial) layout of the frame has happened. This is the earliest time something can be shown on the screen.

### QString QWebFrame::innerText () const

returns the content of this frame as plain text.

### void QWebFrame::layout ()

Ensure that the content of the frame and all subframes are correctly layouted.

### void QWebFrame::load ( const QUrl & url )

Load url into this frame.

### void QWebFrame::load ( const QWebNetworkRequest & req )

This is an overloaded member function, provided for convenience.

Load network request req into this frame.

### void QWebFrame::loadDone ( bool ok ) `[signal]`

This signal is emitted when the frame is completely loaded. ok will indicate whether the load was successful or any error occurred.

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

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

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

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

### QString QWebFrame::markup () const

returns the markup (HTML) contained in the current frame.

### QString QWebFrame::name () const

The name of this frame as defined by the parent frame.

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

The web page that contains this frame.

### QWebFrame * QWebFrame::parentFrame () const

Returns the parent frame of this frame, or 0 if the frame is the web pages main frame.

This is equivalent to qobject_cast<QWebFrame*>(frame->parent()).

### QPoint QWebFrame::pos () const

returns the position of the frame relative to it's parent frame.

### void QWebFrame::render ( QPainter * painter, const QRegion & clip )

Render the frame into painter clipping to clip.

### QString QWebFrame::renderTreeDump () const

returns a dump of the rendering tree. Mainly useful for debugging html.

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

Sets the content of this frame to data assuming mimeType. If mimeType is not specified it defaults to 'text/html'. baseUrl us optional and used to resolve relative URLs in the document.

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

Sets the content of this frame to html. baseUrl is optional and used to resolve relative URLs in the document.

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

This is an overloaded member function, provided for convenience.

### QString QWebFrame::title () const

The title of the frame as defined by the HTML &lt;title&gt; element.

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

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

See also title().

### QUrl QWebFrame::url () const

The url of this frame.

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

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

See also url().