summaryrefslogtreecommitdiffstats
path: root/src/webenginequick/doc/src/navigation_history.qdoc
blob: 0f3a4c7634b154d5f185d0610096f2b51b3c567d (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \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.
*/