Home · All Classes · All Functions · Overviews

QWebHistory Class Reference
[
QtWebKit module]

The QWebHistory class represents the history of a QWebPage More...

 #include <QWebHistory>

This class is not part of the Qt GUI Framework Edition.

This class was introduced in Qt 4.4.


Public Types

enum HistoryStateVersion { HistoryVersion_1, DefaultHistoryVersion }

Public Functions

void back ()
QWebHistoryItem backItem () const
QList<QWebHistoryItem> backItems ( int maxItems ) const
bool canGoBack () const
bool canGoForward () const
void clear ()
int count () const
QWebHistoryItem currentItem () const
int currentItemIndex () const
void forward ()
QWebHistoryItem forwardItem () const
QList<QWebHistoryItem> forwardItems ( int maxItems ) const
void goToItem ( const QWebHistoryItem & item )
QWebHistoryItem itemAt ( int i ) const
QList<QWebHistoryItem> items () const
int maximumItemCount () const
bool restoreState ( const QByteArray & buffer )
QByteArray saveState ( HistoryStateVersion version = DefaultHistoryVersion ) const
void setMaximumItemCount ( int count )

Related Non-Members

QDataStream & operator<< ( QDataStream & stream, const QWebHistory & history )
QDataStream & operator>> ( QDataStream & stream, QWebHistory & history )

Detailed Description

The QWebHistory class represents the history of a QWebPage

Each QWebPage instance contains a history of visited pages that can be accessed by QWebPage::history(). QWebHistory represents this history and makes it possible to navigate it.

The history uses the concept of a current item, dividing the pages visited into those that can be visited by navigating back and forward using the back() and forward() functions. The current item can be obtained by calling currentItem(), and an arbitrary item in the history can be made the current item by passing it to goToItem().

A list of items describing the pages that can be visited by going back can be obtained by calling the backItems() function; similarly, items describing the pages ahead of the current page can be obtained with the forwardItems() function. The total list of items is obtained with the items() function.

Just as with containers, functions are available to examine the history in terms of a list. Arbitrary items in the history can be obtained with itemAt(), the total number of items is given by count(), and the history can be cleared with the clear() function.

QWebHistory's state can be saved with saveState() and loaded with restoreState().

See also QWebHistoryItem, QWebHistoryInterface, and QWebPage.


Member Type Documentation

enum QWebHistory::HistoryStateVersion

This enum describes the versions available for QWebHistory's saveState() function:

ConstantValueDescription
QWebHistory::HistoryVersion_10Version 1 (Qt 4.6)
QWebHistory::DefaultHistoryVersionHistoryVersion_1The current default version in 1.


Member Function Documentation

void QWebHistory::back ()

Set the current item to be the previous item in the history and goes to the corresponding page; i.e., goes back one history item.

See also forward() and goToItem().

QWebHistoryItem QWebHistory::backItem () const

Returns the item before the current item in the history.

QList<QWebHistoryItem> QWebHistory::backItems ( int maxItems ) const

Returns the list of items in the backwards history list. At most maxItems entries are returned.

See also forwardItems().

bool QWebHistory::canGoBack () const

Returns true if there is an item preceding the current item in the history; otherwise returns false.

See also canGoForward().

bool QWebHistory::canGoForward () const

Returns true if we have an item to go forward to; otherwise returns false.

See also canGoBack().

void QWebHistory::clear ()

Clears the history.

See also count() and items().

int QWebHistory::count () const

Returns the total number of items in the history.

QWebHistoryItem QWebHistory::currentItem () const

Returns the current item in the history.

int QWebHistory::currentItemIndex () const

Returns the index of the current item in history.

This function was introduced in Qt 4.5.

void QWebHistory::forward ()

Sets the current item to be the next item in the history and goes to the corresponding page; i.e., goes forward one history item.

See also back() and goToItem().

QWebHistoryItem QWebHistory::forwardItem () const

Returns the item after the current item in the history.

QList<QWebHistoryItem> QWebHistory::forwardItems ( int maxItems ) const

Returns the list of items in the forward history list. At most maxItems entries are returned.

See also backItems().

void QWebHistory::goToItem ( const QWebHistoryItem & item )

Sets the current item to be the specified item in the history and goes to the page.

See also back() and forward().

QWebHistoryItem QWebHistory::itemAt ( int i ) const

Returns the item at index i in the history.

QList<QWebHistoryItem> QWebHistory::items () const

Returns a list of all items currently in the history.

See also count() and clear().

int QWebHistory::maximumItemCount () const

Returns the maximum number of items in the history.

This function was introduced in Qt 4.5.

See also setMaximumItemCount().

bool QWebHistory::restoreState ( const QByteArray & buffer )

Restores the state of QWebHistory from the given buffer. Returns true if the history was successfully restored; otherwise returns false.

This function was introduced in Qt 4.6.

See also saveState().

QByteArray QWebHistory::saveState ( HistoryStateVersion version = DefaultHistoryVersion ) const

Saves the state of this QWebHistory into a QByteArray.

Saves the current state of this QWebHistory. The version number, version, is stored as part of the data.

To restore the saved state, pass the return value to restoreState().

This function was introduced in Qt 4.6.

See also restoreState().

void QWebHistory::setMaximumItemCount ( int count )

Sets the maximum number of items in the history to count.

This function was introduced in Qt 4.5.

See also maximumItemCount().


Related Non-Members

QDataStream & operator<< ( QDataStream & stream, const QWebHistory & history )

The operator<< function streams a history into a data stream.

It saves the history into the specified stream. This is a convenience function and is equivalent to calling the saveState() method.

This function was introduced in Qt 4.6.

See also QWebHistory::saveState().

QDataStream & operator>> ( QDataStream & stream, QWebHistory & history )

The operator>> function loads a history from a data stream.

Loads a QWebHistory from the specified stream into the given history. This is a convenience function and it is equivalent to calling the restoreState() method.

This function was introduced in Qt 4.6.

See also QWebHistory::restoreState().


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.6.0