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

# QWebFrame Class Reference
[QtWebKit module]

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

- icon : const QIcon
- textSizeMultiplier : qreal
- title : const QString
- url : QUrl

- 1 property inherited from QObject

### Public Functions

- void addToJavaScriptWindowObject ( const QString & name, QObject * object )
- QList<QWebFrame *> childFrames () const
- QString frameName () const
- QRect geometry () const
- QIcon icon () const
- void load ( const QUrl & url )
- void load ( const QWebNetworkRequest & req )
- QWebPage * page () const
- QWebFrame * parentFrame () const
- QPoint pos () const
- void render ( QPainter * painter, const QRegion & clip )
- void render ( QPainter * painter )
- QString renderTreeDump () const
- int scrollBarMaximum ( Qt::Orientation orientation ) const
- int scrollBarMinimum ( Qt::Orientation orientation ) const
- Qt::ScrollBarPolicy scrollBarPolicy ( Qt::Orientation orientation ) const
- int scrollBarValue ( Qt::Orientation orientation ) 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 setScrollBarPolicy ( Qt::Orientation orientation, Qt::ScrollBarPolicy policy )
- void setScrollBarValue ( Qt::Orientation orientation, int value )
- void setTextSizeMultiplier ( qreal factor )
- void setUrl ( const QUrl & url )
- qreal textSizeMultiplier () const
- QString title () const
- QString toHtml () const
- QString toPlainText () const
- QUrl url () const

- 29 public functions inherited from QObject

### Public Slots

- QVariant evaluateJavaScript ( const QString & scriptSource )
- void print ( QPrinter * printer ) const

- 1 public slot inherited from QObject

### Signals

- void iconChanged ()
- void initialLayoutCompleted ()
- void javaScriptWindowObjectCleared ()
- 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

### icon : const QIcon

This property holds the icon associated with this frame.

Access functions:

- QIcon icon () const

### textSizeMultiplier : qreal

This property holds the scaling factor for all text in the frame.

Access functions:

- qreal textSizeMultiplier () const
- void setTextSizeMultiplier ( qreal factor )

### title : const QString

This property holds the title of the frame as defined by the HTML <title> element.

Access functions:

- QString title () const

### url : QUrl

This property holds the url of the frame currently viewed.

Access functions:

- QUrl url () const
- void setUrl ( const QUrl & url )

## Member Function Documentation

### void QWebFrame::addToJavaScriptWindowObject ( 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.

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

Evaluate JavaScript defined by scriptSource using this frame as context.

### QString QWebFrame::frameName () const

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

### QRect QWebFrame::geometry () const

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

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

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

### void QWebFrame::initialLayoutCompleted () `[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.

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

This signal is emitted whenever the global window object of the JavaScript environment is cleared (e.g. before starting a new load).

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

Loads url into this frame.

Note: The view remains the same until enough data has arrived to display the new url.

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

This is an overloaded member function, provided for convenience.

Loads a network request, req, into this frame.

Note: The view remains the same until enough data has arrived to display the new url.

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

### 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::print ( QPrinter * printer ) const `[slot]`

Prints the frame to the given printer.

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

Render the frame into painter clipping to clip.

### void QWebFrame::render ( QPainter * painter )

This is an overloaded member function, provided for convenience.

Render the frame into painter.

### QString QWebFrame::renderTreeDump () const

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

### int QWebFrame::scrollBarMaximum ( Qt::Orientation orientation ) const

Returns the maximum value for the scrollbar with orientation orientation, or 0 if no scrollbar is found for orientation.

### int QWebFrame::scrollBarMinimum ( Qt::Orientation orientation ) const

Returns the minimum value for the scrollbar with orientation orientation.

The minimum value is always 0.

### Qt::ScrollBarPolicy QWebFrame::scrollBarPolicy ( Qt::Orientation orientation ) const

Returns the scrollbar policy for the scrollbar defined by orientation.

See also setScrollBarPolicy().

### int QWebFrame::scrollBarValue ( Qt::Orientation orientation ) const

Returns the current value for the scrollbar with orientation orientation, or 0 if no scrollbar is found for orientation.

See also setScrollBarValue().

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

Sets the content of this frame 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.

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

### void QWebFrame::setScrollBarPolicy ( Qt::Orientation orientation, Qt::ScrollBarPolicy policy )

Sets the scrollbar policy for the scrollbar defined by orientation to policy.

See also scrollBarPolicy().

### void QWebFrame::setScrollBarValue ( Qt::Orientation orientation, int value )

Sets the current value for the scrollbar with orientation orientation.

The scrollbar forces the value to be within the legal range: minimum <= value <= maximum.

Changing the value also updates the thumb position.

See also scrollBarValue().

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

This signal is emitted whenever the title of the frame changes. The title string specifies the new title.

See also title().

### QString QWebFrame::toHtml () const

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

### QString QWebFrame::toPlainText () const

returns the content of this frame as plain text.

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

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

See also url().