// Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \qmltype WebEngineHistoryModel \instantiates QWebEngineHistoryModel \inqmlmodule QtWebEngine \since QtWebEngine 1.1 \brief A data model that represents the history of a web engine page. The WebEngineHistoryModel type exposes the \e title, \e url, \e icon, and \e offset roles. The \e title, \e url and \e icon specify the title, URL, and favicon of the visited page. The \e 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 \l{WebEngineView::history}{WebEngineView.history} property. \sa WebEngineHistory */ /*! \qmltype WebEngineHistory \instantiates QWebEngineHistory \inqmlmodule QtWebEngine \since QtWebEngine 1.1 \brief Provides data models that represent the history of a web engine page. The WebEngineHistory type can be accessed by using the \l{WebEngineView::history}{WebEngineView.history} property. The WebEngineHistory type provides the following WebEngineHistoryModel data model objects: \list \li \c backItems, which contains the URLs of visited pages. \li \c forwardItems, which contains the URLs of the pages that were visited after visiting the current page. \li \c items, which contains the URLs of the back and forward items, as well as the URL of the current page. \endlist The easiest way to use these models is to use them in a ListView as illustrated by the following code snippet: \code ListView { id: historyItemsList anchors.fill: parent model: webEngineView.history.items delegate: Text { color: "black" text: model.title + " - " + model.url + " (" + model.offset + ")" } } \endcode The ListView shows the content of the corresponding model. The delegate is responsible for the format of the list items. The appearance of each item of the list in the delegate can be defined separately (it is not web engine specific). The model roles \e title, \e url, and \e icon specify the title, URL, and favicon of the visited page. The \e offset role 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. The data models can also be used to create a menu, as illustrated by the following code snippet: \quotefromfile webenginequick/quicknanobrowser/BrowserWindow.qml \skipto ToolBar \printuntil onObjectRemoved \printuntil } \printuntil } \printuntil } For the complete example, see \l{WebEngine Quick Nano Browser}. \sa WebEngineHistoryModel */ /*! \qmlproperty WebEngineHistoryModel WebEngineHistory::items \readonly URLs of back items, forward items, and the current item in the history. */ /*! \qmlproperty WebEngineHistoryModel WebEngineHistory::backItems \readonly URLs of visited pages. */ /*! \qmlproperty WebEngineHistoryModel WebEngineHistory::forwardItems \readonly URLs of the pages that were visited after visiting the current page. */ /*! \qmlmethod void WebEngineHistory::clear() \since QtWebEngine 1.11 Clears the history. */