QWebEngineHistoryModel Class

A data model that represents the history of a web engine page. More...

Header: #include <QWebEngineHistoryModel>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
Since: Qt 6.2
Instantiated By: WebEngineHistoryModel
Inherits: QAbstractListModel

Public Types

enum Roles { UrlRole, TitleRole, OffsetRole, IconUrlRole }

Public Functions

void reset()

Reimplemented Public Functions

virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
virtual QHash<int, QByteArray> roleNames() const override
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override
void cleanup(QWebEngineHistoryModel *)

Detailed Description

The QWebEngineHistoryModel type exposes the title, url, icon, and offset roles. The title, url and icon specify the title, URL, and favicon of the visited page. The offset specifies the position of the page in respect to the current page (0). A positive number indicates that the page was visited after the current page, whereas a negative number indicates that the page was visited before the current page.

This type is uncreatable, but it can be accessed by using the QWebEngineHistory::itemsModel, QWebEngineHistory::backItemsModel, QWebEngineHistory::forwardItemsModel methods.

See also QWebEngineHistory.

Member Type Documentation

enum QWebEngineHistoryModel::Roles

This enum describes specific roles, which history data model supports.

ConstantValueDescription
QWebEngineHistoryModel::UrlRoleQt::UserRoleURL of the visited page
QWebEngineHistoryModel::TitleRole257Title of the visited page
QWebEngineHistoryModel::OffsetRole258The offset of the page in respect to the current page (0)
QWebEngineHistoryModel::IconUrlRole259Favicon of the visited page

Member Function Documentation

[override virtual] QVariant QWebEngineHistoryModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

void QWebEngineHistoryModel::reset()

[override virtual] QHash<int, QByteArray> QWebEngineHistoryModel::roleNames() const

[override virtual] int QWebEngineHistoryModel::rowCount(const QModelIndex &parent = QModelIndex()) const

Related Non-Members

[static] void cleanup(QWebEngineHistoryModel *)

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.