diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-02-05 15:53:57 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-02-11 08:29:28 +0100 |
commit | 09a6eac4a63b32548ecc1ff5b16a5d8fc3ba1c04 (patch) | |
tree | 924c615feb59f8d3372886ec53121b05b1701d28 /src/pdf/quick/qquickpdfnavigationstack_p.h | |
parent | 25a371caa376c513f22d5c01e425a18629657fdc (diff) |
Add QPdfDestination; NavigationStack stores page, location and zoom
Push/back/forward behavior seems more correct now, but still no
autotest yet.
QPdfDestination might be useful to represent locations of search results,
for link destinations and maybe named destinations too.
Fixes: QTBUG-77512
Change-Id: I113b2c535a2cd302106e6546104c64e12985d387
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/pdf/quick/qquickpdfnavigationstack_p.h')
-rw-r--r-- | src/pdf/quick/qquickpdfnavigationstack_p.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/pdf/quick/qquickpdfnavigationstack_p.h b/src/pdf/quick/qquickpdfnavigationstack_p.h index 54713fabb..8d7102fb1 100644 --- a/src/pdf/quick/qquickpdfnavigationstack_p.h +++ b/src/pdf/quick/qquickpdfnavigationstack_p.h @@ -49,6 +49,7 @@ // #include "qquickpdfdocument_p.h" +#include "../api/qpdfdestination_p.h" #include <QtQml/qqml.h> @@ -57,32 +58,38 @@ QT_BEGIN_NAMESPACE class QQuickPdfNavigationStack : public QObject { Q_OBJECT - Q_PROPERTY(int currentPage READ currentPage WRITE setCurrentPage NOTIFY currentPageChanged) + Q_PROPERTY(int currentPage READ currentPage NOTIFY currentPageChanged) + Q_PROPERTY(QPointF currentLocation READ currentLocation NOTIFY currentLocationChanged) + Q_PROPERTY(qreal currentZoom READ currentZoom NOTIFY currentZoomChanged) Q_PROPERTY(bool backAvailable READ backAvailable NOTIFY backAvailableChanged) Q_PROPERTY(bool forwardAvailable READ forwardAvailable NOTIFY forwardAvailableChanged) public: explicit QQuickPdfNavigationStack(QObject *parent = nullptr); + Q_INVOKABLE void push(int page, QPointF location, qreal zoom); + Q_INVOKABLE void update(int page, QPointF location, qreal zoom); Q_INVOKABLE void forward(); Q_INVOKABLE void back(); - int currentPage() const { return m_currentPage; } - void setCurrentPage(int currentPage); + int currentPage() const; + QPointF currentLocation() const; + qreal currentZoom() const; bool backAvailable() const; bool forwardAvailable() const; Q_SIGNALS: void currentPageChanged(); - void currentPageJumped(int page); + void currentLocationChanged(); + void currentZoomChanged(); void backAvailableChanged(); void forwardAvailableChanged(); + void jumped(int page, QPointF location, qreal zoom); private: - QVector<int> m_pageHistory; - int m_nextHistoryIndex = 0; - int m_currentPage = 0; + QVector<QExplicitlySharedDataPointer<QPdfDestinationPrivate>> m_pageHistory; + int m_currentHistoryIndex = 0; bool m_changing = false; Q_DISABLE_COPY(QQuickPdfNavigationStack) |