QWebEngineHistory 類錶示 Web 引擎頁麵的曆史。 更多...
| 頭: | #include <QWebEngineHistory> |
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore) |
| qmake: | QT += webenginecore |
| 實例化: | WebEngineHistory |
| 繼承: | QObject |
| void | back () |
| QWebEngineHistoryItem | backItem () const |
| QList<QWebEngineHistoryItem> | backItems (int maxItems ) const |
| QWebEngineHistoryModel * | backItemsModel () 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 |
| QWebEngineHistoryModel * | forwardItemsModel () const |
| void | goToItem (const QWebEngineHistoryItem & item ) |
| QWebEngineHistoryItem | itemAt (int i ) const |
| QList<QWebEngineHistoryItem> | items () const |
| QWebEngineHistoryModel * | itemsModel () const |
| QDataStream & | operator<< (QDataStream & stream , const QWebEngineHistory & history ) |
| QDataStream & | operator>> (QDataStream & stream , QWebEngineHistory & history ) |
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 items () 函數。
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 () 函數。
QWebEngineHistory's state can be saved to a QDataStream using the >> operator and loaded by using the << operator.
另請參閱 QWebEngineHistoryItem and QWebEnginePage .
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 ().
返迴曆史中在當前項之前的項。
Returns the list of items in the backwards history list. At most maxItems entries are returned.
另請參閱 forwardItems ().
Return the data model, which represents URLs of visited pages.
注意: getter 函數對於特性 backItems .
返迴
true
if there is an item preceding the current item in the history; otherwise returns
false
.
另請參閱 canGoForward ().
返迴
true
if we have an item to go forward to; otherwise returns
false
.
另請參閱 canGoBack ().
[invokable]
void
QWebEngineHistory::
clear
()
清零曆史。
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
Returns the total number of items in the history.
Returns the current item in the history.
Returns the index of the current item in history.
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.
Returns the item after the current item in the history.
Returns the list of items in the forward history list. At most maxItems entries are returned.
另請參閱 backItems ().
Return the data model, which represents URLs of the pages that were visited after visiting the current page.
注意: getter 函數對於特性 forwardItems .
Sets the current item to be the specified item in the history and goes to the page.
Returns the item at index i in the history.
Returns a list of all items currently in the history.
Returns the data model, which represents URLs of back items, forward items, and the current item in the history.
注意: getter 函數對於特性 items .
Saves the web engine history history into stream .
Loads the web engine history from stream into history .