summaryrefslogtreecommitdiffstats
path: root/src/webenginequick/doc/src/navigation_history.qdoc
blob: 94876799da148b2ae6ac8c410225d17ddc5207c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// 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.
*/