QWebEngineHistory 类

The QWebEngineHistory class represents the history of a web engine page. 更多...

头: #include <QWebEngineHistory>
qmake: QT += webenginewidgets
Since: Qt 5.4

公共函数

void back ()
QWebEngineHistoryItem backItem () const
QList<QWebEngineHistoryItem> backItems (int maxItems ) const
bool canGoBack () const
bool canGoForward () const
void clear ()
int count () const
QWebEngineHistoryItem currentItem () const
int currentItemIndex () const
void forward ()
QWebEngineHistoryItem forwardItem () const
QList<QWebEngineHistoryItem> forwardItems (int maxItems ) const
void goToItem (const QWebEngineHistoryItem & item )
QWebEngineHistoryItem itemAt (int i ) const
QList<QWebEngineHistoryItem> () const
QDataStream & operator<< (QDataStream & stream , const QWebEngineHistory & history )
QDataStream & operator>> (QDataStream & stream , QWebEngineHistory & history )

详细描述

The QWebEngineHistory class represents the history of a web engine page.

Each web engine page contains a history of visited pages that can be accessed by QWebEnginePage::history ().

The history uses the concept of a current item , dividing the pages visited into those that can be visited by navigating back and forward 使用 back () 和 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 () 函数。

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 () 函数。

QWebEngineHistory 's state can be saved to a QDataStream using the >> operator and loaded by using the << operator.

另请参阅 QWebEngineHistoryItem and QWebEnginePage .

成员函数文档编制

void QWebEngineHistory:: back ()

Sets the current item to be the previous item in the history and goes to the corresponding page; that is, goes back one history item.

另请参阅 forward () 和 goToItem ().

QWebEngineHistoryItem QWebEngineHistory:: backItem () const

返回历史中在当前项之前的项。

QList < QWebEngineHistoryItem > QWebEngineHistory:: backItems ( int maxItems ) const

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

另请参阅 forwardItems ().

bool QWebEngineHistory:: canGoBack () const

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

另请参阅 canGoForward ().

bool QWebEngineHistory:: canGoForward () const

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

另请参阅 canGoBack ().

void QWebEngineHistory:: clear ()

清零历史。

另请参阅 count () 和 ().

int QWebEngineHistory:: count () const

Returns the total number of items in the history.

QWebEngineHistoryItem QWebEngineHistory:: currentItem () const

Returns the current item in the history.

int QWebEngineHistory:: currentItemIndex () const

Returns the index of the current item in history.

void QWebEngineHistory:: forward ()

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

另请参阅 back () 和 goToItem ().

QWebEngineHistoryItem QWebEngineHistory:: forwardItem () const

Returns the item after the current item in the history.

QList < QWebEngineHistoryItem > QWebEngineHistory:: forwardItems ( int maxItems ) const

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

另请参阅 backItems ().

void QWebEngineHistory:: goToItem (const QWebEngineHistoryItem & item )

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

另请参阅 back () 和 forward ().

QWebEngineHistoryItem QWebEngineHistory:: itemAt ( int i ) const

Returns the item at index i in the history.

QList < QWebEngineHistoryItem > QWebEngineHistory:: () const

Returns a list of all items currently in the history.

另请参阅 count () 和 clear ().

相关非成员

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

Saves the web engine history history into stream .

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

Loads the web engine history from stream into history .