Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickpdfpagenavigator.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5#include <QLoggingCategory>
6
7QT_BEGIN_NAMESPACE
8
9/*!
10 \qmltype PdfPageNavigator
11//! \nativetype QQuickPdfPageNavigator
12 \inqmlmodule QtQuick.Pdf
13 \ingroup pdf
14 \brief History of the destinations visited within a PDF Document.
15 \since 5.15
16
17 PdfPageNavigator remembers which destinations the user has visited in a PDF
18 document, and provides the ability to traverse backward and forward.
19*/
20
21QQuickPdfPageNavigator::QQuickPdfPageNavigator(QObject *parent)
22 : QObject(parent)
23{
24}
25
26/*!
27 \internal
28*/
29QQuickPdfPageNavigator::~QQuickPdfPageNavigator() = default;
30
31/*!
32 \internal
33*/
34QPdfPageNavigator *QQuickPdfPageNavigator::navStack()
35{
36 return static_cast<QPdfPageNavigator *>(qmlExtendedObject(this));
37}
38
39/*!
40 \qmlmethod void PdfPageNavigator::forward()
41
42 Goes back to the page, location and zoom level that was being viewed before
43 back() was called, and then emits the \l jumped() signal.
44
45 If a new destination was pushed since the last time \l back() was called,
46 the forward() function does nothing, because there is a branch in the
47 timeline which causes the "future" to be lost.
48*/
49
50/*!
51 \qmlmethod void PdfPageNavigator::back()
52
53 Pops the stack, updates the \l currentPage, \l currentLocation and
54 \l currentZoom properties to the most-recently-viewed destination, and then
55 emits the \l jumped() signal.
56*/
57
58/*!
59 \qmlproperty int PdfPageNavigator::currentPage
60
61 This property holds the current page that is being viewed.
62 If there is no current page, it holds \c -1.
63*/
64
65/*!
66 \qmlproperty point PdfPageNavigator::currentLocation
67
68 This property holds the current location on the page that is being viewed.
69*/
70
71/*!
72 \qmlproperty real PdfPageNavigator::currentZoom
73
74 This property holds the magnification scale on the page that is being viewed.
75*/
76
77/*!
78 \qmlmethod void PdfPageNavigator::jump(int page, point location, qreal zoom, bool emitJumped)
79
80 Adds the given destination, consisting of \a page, \a location, and \a zoom,
81 to the history of visited locations. If \a emitJumped is \c false, the
82 \l jumped() signal will not be emitted.
83
84 If forwardAvailable is \c true, calling this function represents a branch
85 in the timeline which causes the "future" to be lost, and therefore
86 forwardAvailable will change to \c false.
87*/
88
89/*!
90 \qmlmethod void PdfPageNavigator::update(int page, point location, qreal zoom)
91
92 Modifies the current destination, consisting of \a page, \a location and \a zoom.
93
94 This can be called periodically while the user is manually moving around
95 the document, so that after back() is called, forward() will jump back to
96 the most-recently-viewed destination rather than the destination that was
97 last specified by jump().
98
99 The \c currentZoomChanged, \c currentPageChanged and \c currentLocationChanged
100 signals will be emitted if the respective properties are actually changed.
101 The \l jumped signal is not emitted, because this operation
102 represents smooth movement rather than a navigational jump.
103*/
104
105/*!
106 \qmlproperty bool PdfPageNavigator::backAvailable
107 \readonly
108
109 Holds \c true if a \e back destination is available in the history.
110*/
111
112/*!
113 \qmlproperty bool PdfPageNavigator::forwardAvailable
114 \readonly
115
116 Holds \c true if a \e forward destination is available in the history.
117*/
118
119/*!
120 \qmlsignal PdfPageNavigator::jumped(int page, point location, qreal zoom)
121
122 This signal is emitted when an abrupt jump occurs, to the specified \a page
123 index, \a location on the page, and \a zoom level; but \e not when simply
124 scrolling through the document one page at a time. That is, forward(),
125 back() and jump() always emit this signal; update() does not.
126*/
127
128QT_END_NAMESPACE
129
130#include "moc_qquickpdfpagenavigator_p.cpp"