QWebEngineHistory

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

Inheritance diagram of PySide6.QtWebEngineCore.QWebEngineHistory

Synopsis

Functions

Detailed Description

Each web engine page contains a history of visited pages that can be accessed by 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 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.

Also, the following QWebEngineHistoryModel data model objects are provided:

  • backItemsModel(), which contains the URLs of visited pages.

  • forwardItemsModel(), which contains the URLs of the pages that were visited after visiting the current page.

  • itemsModel(), which contains the URLs of the back and forward items, as well as the URL of the current page.

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.

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

class PySide6.QtWebEngineCore.QWebEngineHistory
PySide6.QtWebEngineCore.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.

PySide6.QtWebEngineCore.QWebEngineHistory.backItem()
Return type

PySide6.QtWebEngineCore.QWebEngineHistoryItem

Returns the item before the current item in the history.

PySide6.QtWebEngineCore.QWebEngineHistory.backItems(maxItems)
Parameters

maxItems – int

Return type

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

See also

forwardItems()

PySide6.QtWebEngineCore.QWebEngineHistory.backItemsModel()
Return type

PySide6.QtWebEngineCore.QWebEngineHistoryModel

PySide6.QtWebEngineCore.QWebEngineHistory.canGoBack()
Return type

bool

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

See also

canGoForward()

PySide6.QtWebEngineCore.QWebEngineHistory.canGoForward()
Return type

bool

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

See also

canGoBack()

PySide6.QtWebEngineCore.QWebEngineHistory.clear()

Clears the history.

See also

count() items()

PySide6.QtWebEngineCore.QWebEngineHistory.count()
Return type

int

Returns the total number of items in the history.

PySide6.QtWebEngineCore.QWebEngineHistory.currentItem()
Return type

PySide6.QtWebEngineCore.QWebEngineHistoryItem

Returns the current item in the history.

PySide6.QtWebEngineCore.QWebEngineHistory.currentItemIndex()
Return type

int

Returns the index of the current item in history.

PySide6.QtWebEngineCore.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.

See also

back() goToItem()

PySide6.QtWebEngineCore.QWebEngineHistory.forwardItem()
Return type

PySide6.QtWebEngineCore.QWebEngineHistoryItem

Returns the item after the current item in the history.

PySide6.QtWebEngineCore.QWebEngineHistory.forwardItems(maxItems)
Parameters

maxItems – int

Return type

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

See also

backItems()

PySide6.QtWebEngineCore.QWebEngineHistory.forwardItemsModel()
Return type

PySide6.QtWebEngineCore.QWebEngineHistoryModel

PySide6.QtWebEngineCore.QWebEngineHistory.goToItem(item)
Parameters

itemPySide6.QtWebEngineCore.QWebEngineHistoryItem

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

See also

back() forward()

PySide6.QtWebEngineCore.QWebEngineHistory.itemAt(i)
Parameters

i – int

Return type

PySide6.QtWebEngineCore.QWebEngineHistoryItem

Returns the item at index i in the history.

PySide6.QtWebEngineCore.QWebEngineHistory.items()
Return type

Returns a list of all items currently in the history.

See also

count() clear()

PySide6.QtWebEngineCore.QWebEngineHistory.itemsModel()
Return type

PySide6.QtWebEngineCore.QWebEngineHistoryModel