diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-04-24 10:54:05 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-05-27 14:20:50 +0200 |
commit | 90f43fd25ec4de4d18da40c214ddb366da5c798a (patch) | |
tree | 3cdc847db7f455134c174c02e2d5f13a07ef54de /src/pdfquick | |
parent | 567739fda232c28992962f32a9e652eab723a4d4 (diff) | |
download | qtwebengine-90f43fd25ec4de4d18da40c214ddb366da5c798a.tar.gz |
Rename QPdfNavigationStack to QPdfPageNavigator; QML type too
This might reduce some confusion about the fact that the back/forward
"stack" isn't strictly a stack in the data structure sense: it's more
like QUndoStack. It causes a QML source incompatibility relative to
Qt 5, but keeps the C++ class name the same as it has been in QtPdf for
a long time. Amends 3ad445f9f24a9d3f259ed1781460a63346a728e4
[ChangeLog][QtPDF] The PdfNavigationStack QML type has been renamed to
PdfPageNavigator, matching the C++ type QPdfPageNavigator. These
remember navigation history within a document, and are helpful to
implement back/forward buttons similar to those on a web browser
in both Qt Quick and widget-based viewer applications.
Change-Id: Id8dc17aa416bb7064b1f0f300a47c07c83b7f47e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/pdfquick')
-rw-r--r-- | src/pdfquick/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/pdfquick/PdfMultiPageView.qml | 50 | ||||
-rw-r--r-- | src/pdfquick/PdfPageView.qml | 46 | ||||
-rw-r--r-- | src/pdfquick/PdfScrollablePageView.qml | 58 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfpagenavigator.cpp (renamed from src/pdfquick/qquickpdfnavigationstack.cpp) | 38 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfpagenavigator_p.h (renamed from src/pdfquick/qquickpdfnavigationstack_p.h) | 24 |
6 files changed, 109 insertions, 109 deletions
diff --git a/src/pdfquick/CMakeLists.txt b/src/pdfquick/CMakeLists.txt index b29f57aeb..bb712be7b 100644 --- a/src/pdfquick/CMakeLists.txt +++ b/src/pdfquick/CMakeLists.txt @@ -19,7 +19,7 @@ qt_internal_add_qml_module(PdfQuick qquickpdfbookmarkmodel.cpp qquickpdfbookmarkmodel_p.h qquickpdfdocument.cpp qquickpdfdocument_p.h qquickpdflinkmodel.cpp qquickpdflinkmodel_p.h - qquickpdfnavigationstack.cpp qquickpdfnavigationstack_p.h + qquickpdfpagenavigator.cpp qquickpdfpagenavigator_p.h qquickpdfpageimage.cpp qquickpdfpageimage_p.h qquickpdfsearchmodel.cpp qquickpdfsearchmodel_p.h qquickpdfselection.cpp qquickpdfselection_p.h diff --git a/src/pdfquick/PdfMultiPageView.qml b/src/pdfquick/PdfMultiPageView.qml index 2457c5010..d7831f6bd 100644 --- a/src/pdfquick/PdfMultiPageView.qml +++ b/src/pdfquick/PdfMultiPageView.qml @@ -125,9 +125,9 @@ Item { \c onCurrentPageChanged script) to update the part of the user interface that shows the current page number, such as a \l SpinBox. - \sa PdfNavigationStack::currentPage + \sa PdfPageNavigator::currentPage */ - property alias currentPage: navigationStack.currentPage + property alias currentPage: pageNavigator.currentPage /*! \qmlproperty bool PdfMultiPageView::backEnabled @@ -136,9 +136,9 @@ Item { This property indicates if it is possible to go back in the navigation history to a previous-viewed page. - \sa PdfNavigationStack::backAvailable, back() + \sa PdfPageNavigator::backAvailable, back() */ - property alias backEnabled: navigationStack.backAvailable + property alias backEnabled: pageNavigator.backAvailable /*! \qmlproperty bool PdfMultiPageView::forwardEnabled @@ -147,9 +147,9 @@ Item { This property indicates if it is possible to go to next location in the navigation history. - \sa PdfNavigationStack::forwardAvailable, forward() + \sa PdfPageNavigator::forwardAvailable, forward() */ - property alias forwardEnabled: navigationStack.forwardAvailable + property alias forwardEnabled: pageNavigator.forwardAvailable /*! \qmlmethod void PdfMultiPageView::back() @@ -158,9 +158,9 @@ Item { recently; or does nothing if there is no previous location on the navigation stack. - \sa PdfNavigationStack::back(), currentPage, backEnabled + \sa PdfPageNavigator::back(), currentPage, backEnabled */ - function back() { navigationStack.back() } + function back() { pageNavigator.back() } /*! \qmlmethod void PdfMultiPageView::forward() @@ -169,19 +169,19 @@ Item { method was called; or does nothing if there is no "next" location on the navigation stack. - \sa PdfNavigationStack::forward(), currentPage + \sa PdfPageNavigator::forward(), currentPage */ - function forward() { navigationStack.forward() } + function forward() { pageNavigator.forward() } /*! \qmlmethod void PdfMultiPageView::goToPage(int page) Scrolls the view to the given \a page number, if possible. - \sa PdfNavigationStack::jump(), currentPage + \sa PdfPageNavigator::jump(), currentPage */ function goToPage(page) { - if (page === navigationStack.currentPage) + if (page === pageNavigator.currentPage) return goToLocation(page, Qt.point(-1, -1), 0) } @@ -192,15 +192,15 @@ Item { Scrolls the view to the \a location on the \a page, if possible, and sets the \a zoom level. - \sa PdfNavigationStack::jump(), currentPage + \sa PdfPageNavigator::jump(), currentPage */ function goToLocation(page, location, zoom) { if (zoom > 0) { - navigationStack.jumping = true // don't call navigationStack.update() because we will jump() instead + pageNavigator.jumping = true // don't call pageNavigator.update() because we will jump() instead root.renderScale = zoom - navigationStack.jumping = false + pageNavigator.jumping = false } - navigationStack.jump(page, location, zoom) // actually jump + pageNavigator.jump(page, location, zoom) // actually jump } /*! @@ -391,7 +391,7 @@ Item { searchHighlights.update() } onStatusChanged: { - if (index === navigationStack.currentPage) + if (index === pageNavigator.currentPage) root.currentPageRenderingStatus = status } } @@ -575,7 +575,7 @@ Item { ? Qt.point((tableView.contentX - currentItem.x + tableView.jumpLocationMargin.x) / root.renderScale, (tableView.contentY - currentItem.y + tableView.jumpLocationMargin.y) / root.renderScale) : Qt.point(0, 0) // maybe the delegate wasn't loaded yet - navigationStack.jump(cell.y, currentLocation, root.renderScale) + pageNavigator.jump(cell.y, currentLocation, root.renderScale) } onActiveChanged: if (!active ) { // When the scrollbar stops moving, tell navstack where we are, so as to update currentPage etc. @@ -585,15 +585,15 @@ Item { ? Qt.point((tableView.contentX - currentItem.x + tableView.jumpLocationMargin.x) / root.renderScale, (tableView.contentY - currentItem.y + tableView.jumpLocationMargin.y) / root.renderScale) : Qt.point(0, 0) // maybe the delegate wasn't loaded yet - navigationStack.update(cell.y, currentLocation, root.renderScale) + pageNavigator.update(cell.y, currentLocation, root.renderScale) } } ScrollBar.horizontal: ScrollBar { } } onRenderScaleChanged: { - // if navigationStack.jumped changes the scale, don't turn around and update the stack again; + // if pageNavigator.jumped changes the scale, don't turn around and update the stack again; // and don't force layout either, because positionViewAtCell() will do that - if (navigationStack.jumping) + if (pageNavigator.jumping) return // make TableView rebuild from scratch, because otherwise it doesn't know the delegates are changing size tableView.rebuild() @@ -602,11 +602,11 @@ Item { if (currentItem) { const currentLocation = Qt.point((tableView.contentX - currentItem.x + tableView.jumpLocationMargin.x) / root.renderScale, (tableView.contentY - currentItem.y + tableView.jumpLocationMargin.y) / root.renderScale) - navigationStack.update(cell.y, currentLocation, renderScale) + pageNavigator.update(cell.y, currentLocation, renderScale) } } - PdfNavigationStack { - id: navigationStack + PdfPageNavigator { + id: pageNavigator property bool jumping: false property int previousPage: 0 onJumped: function(page, location, zoom) { @@ -642,7 +642,7 @@ Item { property url documentSource: root.document.source onDocumentSourceChanged: { - navigationStack.clear() + pageNavigator.clear() root.resetScale() tableView.contentX = 0 tableView.contentY = 0 diff --git a/src/pdfquick/PdfPageView.qml b/src/pdfquick/PdfPageView.qml index eac4fb520..ff4de9b81 100644 --- a/src/pdfquick/PdfPageView.qml +++ b/src/pdfquick/PdfPageView.qml @@ -124,9 +124,9 @@ Rectangle { \c onCurrentPageChanged script) to update the part of the user interface that shows the current page number, such as a \l SpinBox. - \sa PdfNavigationStack::currentPage + \sa PdfPageNavigator::currentPage */ - property alias currentPage: navigationStack.currentPage + property alias currentPage: pageNavigator.currentPage /*! \qmlproperty bool PdfPageView::backEnabled @@ -135,9 +135,9 @@ Rectangle { This property indicates if it is possible to go back in the navigation history to a previous-viewed page. - \sa PdfNavigationStack::backAvailable, back() + \sa PdfPageNavigator::backAvailable, back() */ - property alias backEnabled: navigationStack.backAvailable + property alias backEnabled: pageNavigator.backAvailable /*! \qmlproperty bool PdfPageView::forwardEnabled @@ -146,9 +146,9 @@ Rectangle { This property indicates if it is possible to go to next location in the navigation history. - \sa PdfNavigationStack::forwardAvailable, forward() + \sa PdfPageNavigator::forwardAvailable, forward() */ - property alias forwardEnabled: navigationStack.forwardAvailable + property alias forwardEnabled: pageNavigator.forwardAvailable /*! \qmlmethod void PdfPageView::back() @@ -157,9 +157,9 @@ Rectangle { recently; or does nothing if there is no previous location on the navigation stack. - \sa PdfNavigationStack::back(), currentPage, backEnabled + \sa PdfPageNavigator::back(), currentPage, backEnabled */ - function back() { navigationStack.back() } + function back() { pageNavigator.back() } /*! \qmlmethod void PdfPageView::forward() @@ -168,16 +168,16 @@ Rectangle { method was called; or does nothing if there is no "next" location on the navigation stack. - \sa PdfNavigationStack::forward(), currentPage + \sa PdfPageNavigator::forward(), currentPage */ - function forward() { navigationStack.forward() } + function forward() { pageNavigator.forward() } /*! \qmlmethod void PdfPageView::goToPage(int page) Changes the view to the \a page, if possible. - \sa PdfNavigationStack::jump(), currentPage + \sa PdfPageNavigator::jump(), currentPage */ function goToPage(page) { goToLocation(page, Qt.point(0, 0), 0) } @@ -187,12 +187,12 @@ Rectangle { Scrolls the view to the \a location on the \a page, if possible, and sets the \a zoom level. - \sa PdfNavigationStack::jump(), currentPage + \sa PdfPageNavigator::jump(), currentPage */ function goToLocation(page, location, zoom) { if (zoom > 0) root.renderScale = zoom - navigationStack.jump(page, location, zoom) + pageNavigator.jump(page, location, zoom) } // -------------------------------- @@ -266,7 +266,7 @@ Rectangle { function scaleToPage(width, height) { const windowAspect = width / height const halfRotation = Math.abs(root.rotation % 180) - const pagePointSize = document.pagePointSize(navigationStack.currentPage) + const pagePointSize = document.pagePointSize(pageNavigator.currentPage) const pageAspect = pagePointSize.height / pagePointSize.width if (halfRotation > 45 && halfRotation < 135) { // rotated 90 or 270ยบ @@ -339,7 +339,7 @@ Rectangle { PdfSelection { id: selection document: root.document - page: navigationStack.currentPage + page: pageNavigator.currentPage fromPoint: Qt.point(textSelectionDrag.centroid.pressPosition.x / image.pageScale, textSelectionDrag.centroid.pressPosition.y / image.pageScale) toPoint: Qt.point(textSelectionDrag.centroid.position.x / image.pageScale, textSelectionDrag.centroid.position.y / image.pageScale) hold: !textSelectionDrag.active && !tapHandler.pressed @@ -351,14 +351,14 @@ Rectangle { onCurrentPageChanged: root.goToPage(currentPage) } - PdfNavigationStack { - id: navigationStack + PdfPageNavigator { + id: pageNavigator onCurrentPageChanged: searchModel.currentPage = currentPage onCurrentZoomChanged: root.renderScale = currentZoom property url documentSource: root.document.source onDocumentSourceChanged: { - navigationStack.clear() + pageNavigator.clear() root.goToPage(0) } } @@ -366,13 +366,13 @@ Rectangle { PdfPageImage { id: image document: root.document - currentPage: navigationStack.currentPage + currentPage: pageNavigator.currentPage asynchronous: true fillMode: Image.PreserveAspectFit property bool centerOnLoad: false property bool vCenterOnLoad: false property size centerInSize - property real pageScale: image.paintedWidth / document.pagePointSize(navigationStack.currentPage).width + property real pageScale: image.paintedWidth / document.pagePointSize(pageNavigator.currentPage).width function reRenderIfNecessary() { const newSourceWidth = image.sourceSize.width * root.scale * Screen.devicePixelRatio const ratio = newSourceWidth / image.sourceSize.width @@ -391,7 +391,7 @@ Rectangle { } } onRenderScaleChanged: { - image.sourceSize.width = document.pagePointSize(navigationStack.currentPage).width * renderScale + image.sourceSize.width = document.pagePointSize(pageNavigator.currentPage).width * renderScale image.sourceSize.height = 0 root.scale = 1 } @@ -431,7 +431,7 @@ Rectangle { model: PdfLinkModel { id: linkModel document: root.document - page: navigationStack.currentPage + page: pageNavigator.currentPage } delegate: Item { x: rect.x * image.pageScale @@ -442,7 +442,7 @@ Rectangle { TapHandler { onTapped: { if (page >= 0) - navigationStack.jump(page, Qt.point(0, 0), root.renderScale) + pageNavigator.jump(page, Qt.point(0, 0), root.renderScale) else Qt.openUrlExternally(url) } diff --git a/src/pdfquick/PdfScrollablePageView.qml b/src/pdfquick/PdfScrollablePageView.qml index 6b03c1c1c..6ee42d3ad 100644 --- a/src/pdfquick/PdfScrollablePageView.qml +++ b/src/pdfquick/PdfScrollablePageView.qml @@ -126,9 +126,9 @@ Flickable { \c onCurrentPageChanged script) to update the part of the user interface that shows the current page number, such as a \l SpinBox. - \sa PdfNavigationStack::currentPage + \sa PdfPageNavigator::currentPage */ - property alias currentPage: navigationStack.currentPage + property alias currentPage: pageNavigator.currentPage /*! \qmlproperty bool PdfScrollablePageView::backEnabled @@ -137,9 +137,9 @@ Flickable { This property indicates if it is possible to go back in the navigation history to a previous-viewed page. - \sa PdfNavigationStack::backAvailable, back() + \sa PdfPageNavigator::backAvailable, back() */ - property alias backEnabled: navigationStack.backAvailable + property alias backEnabled: pageNavigator.backAvailable /*! \qmlproperty bool PdfScrollablePageView::forwardEnabled @@ -148,9 +148,9 @@ Flickable { This property indicates if it is possible to go to next location in the navigation history. - \sa PdfNavigationStack::forwardAvailable, forward() + \sa PdfPageNavigator::forwardAvailable, forward() */ - property alias forwardEnabled: navigationStack.forwardAvailable + property alias forwardEnabled: pageNavigator.forwardAvailable /*! \qmlmethod void PdfScrollablePageView::back() @@ -159,9 +159,9 @@ Flickable { recently; or does nothing if there is no previous location on the navigation stack. - \sa PdfNavigationStack::back(), currentPage, backEnabled + \sa PdfPageNavigator::back(), currentPage, backEnabled */ - function back() { navigationStack.back() } + function back() { pageNavigator.back() } /*! \qmlmethod void PdfScrollablePageView::forward() @@ -170,19 +170,19 @@ Flickable { method was called; or does nothing if there is no "next" location on the navigation stack. - \sa PdfNavigationStack::forward(), currentPage + \sa PdfPageNavigator::forward(), currentPage */ - function forward() { navigationStack.forward() } + function forward() { pageNavigator.forward() } /*! \qmlmethod void PdfScrollablePageView::goToPage(int page) Changes the view to the \a page, if possible. - \sa PdfNavigationStack::jump(), currentPage + \sa PdfPageNavigator::jump(), currentPage */ function goToPage(page) { - if (page === navigationStack.currentPage) + if (page === pageNavigator.currentPage) return goToLocation(page, Qt.point(0, 0), 0) } @@ -193,12 +193,12 @@ Flickable { Scrolls the view to the \a location on the \a page, if possible, and sets the \a zoom level. - \sa PdfNavigationStack::jump(), currentPage + \sa PdfPageNavigator::jump(), currentPage */ function goToLocation(page, location, zoom) { if (zoom > 0) root.renderScale = zoom - navigationStack.jump(page, location, zoom) + pageNavigator.jump(page, location, zoom) } // -------------------------------- @@ -254,7 +254,7 @@ Flickable { degrees, it will be scaled so that its width fits \a height. */ function scaleToWidth(width, height) { - const pagePointSize = document.pagePointSize(navigationStack.currentPage) + const pagePointSize = document.pagePointSize(pageNavigator.currentPage) root.renderScale = root.width / (paper.rot90 ? pagePointSize.height : pagePointSize.width) console.log(lcSPV, "scaling", pagePointSize, "to fit", root.width, "rotated?", paper.rot90, "scale", root.renderScale) root.contentX = 0 @@ -270,7 +270,7 @@ Flickable { it is first rotated to have a matching aspect ratio. */ function scaleToPage(width, height) { - const pagePointSize = document.pagePointSize(navigationStack.currentPage) + const pagePointSize = document.pagePointSize(pageNavigator.currentPage) root.renderScale = Math.min( root.width / (paper.rot90 ? pagePointSize.height : pagePointSize.width), root.height / (paper.rot90 ? pagePointSize.width : pagePointSize.height) ) @@ -331,7 +331,7 @@ Flickable { if (!active ) { const currentLocation = Qt.point((root.contentX + root.width / 2) / root.renderScale, (root.contentY + root.height / 2) / root.renderScale) - navigationStack.update(navigationStack.currentPage, currentLocation, root.renderScale) + pageNavigator.update(pageNavigator.currentPage, currentLocation, root.renderScale) } } ScrollBar.horizontal: ScrollBar { @@ -339,18 +339,18 @@ Flickable { if (!active ) { const currentLocation = Qt.point((root.contentX + root.width / 2) / root.renderScale, (root.contentY + root.height / 2) / root.renderScale) - navigationStack.update(navigationStack.currentPage, currentLocation, root.renderScale) + pageNavigator.update(pageNavigator.currentPage, currentLocation, root.renderScale) } } onRenderScaleChanged: { - image.sourceSize.width = document.pagePointSize(navigationStack.currentPage).width * + image.sourceSize.width = document.pagePointSize(pageNavigator.currentPage).width * renderScale * Screen.devicePixelRatio image.sourceSize.height = 0 paper.scale = 1 const currentLocation = Qt.point((root.contentX + root.width / 2) / root.renderScale, (root.contentY + root.height / 2) / root.renderScale) - navigationStack.update(navigationStack.currentPage, currentLocation, root.renderScale) + pageNavigator.update(pageNavigator.currentPage, currentLocation, root.renderScale) } PdfSearchModel { @@ -361,8 +361,8 @@ Flickable { Qt.point(currentResultBoundingRect.x, currentResultBoundingRect.y), 0) } - PdfNavigationStack { - id: navigationStack + PdfPageNavigator { + id: pageNavigator onJumped: function(page, location, zoom) { root.renderScale = zoom const dx = Math.max(0, location.x * root.renderScale - root.width / 2) - root.contentX @@ -379,7 +379,7 @@ Flickable { property url documentSource: root.document.source onDocumentSourceChanged: { - navigationStack.clear() + pageNavigator.clear() root.resetScale() root.contentX = 0 root.contentY = 0 @@ -401,12 +401,12 @@ Flickable { PdfPageImage { id: image document: root.document - currentPage: navigationStack.currentPage + currentPage: pageNavigator.currentPage asynchronous: true fillMode: Image.PreserveAspectFit rotation: root.pageRotation anchors.centerIn: parent - property real pageScale: image.paintedWidth / document.pagePointSize(navigationStack.currentPage).width + property real pageScale: image.paintedWidth / document.pagePointSize(pageNavigator.currentPage).width Shape { anchors.fill: parent @@ -441,7 +441,7 @@ Flickable { model: PdfLinkModel { id: linkModel document: root.document - page: navigationStack.currentPage + page: pageNavigator.currentPage } delegate: Shape { required property rect rect @@ -469,7 +469,7 @@ Flickable { TapHandler { onTapped: { if (page >= 0) - navigationStack.jump(page, Qt.point(0, 0), root.renderScale) + pageNavigator.jump(page, Qt.point(0, 0), root.renderScale) else Qt.openUrlExternally(url) } @@ -507,7 +507,7 @@ Flickable { id: selection anchors.fill: parent document: root.document - page: navigationStack.currentPage + page: pageNavigator.currentPage renderScale: image.pageScale == 0 ? 1.0 : image.pageScale fromPoint: textSelectionDrag.centroid.pressPosition toPoint: textSelectionDrag.centroid.position @@ -539,7 +539,7 @@ Flickable { paper.y = 0 root.contentX = centroidOnPage.x - centroidInFlickable.x root.contentY = centroidOnPage.y - centroidInFlickable.y - root.renderScale *= ratio // onRenderScaleChanged calls navigationStack.update() so we don't need to here + root.renderScale *= ratio // onRenderScaleChanged calls pageNavigator.update() so we don't need to here console.log(lcSPV, "contentX/Y adjusted to", root.contentX.toFixed(2), root.contentY.toFixed(2)) } else { paper.x = 0 diff --git a/src/pdfquick/qquickpdfnavigationstack.cpp b/src/pdfquick/qquickpdfpagenavigator.cpp index c36e993d4..346b49b71 100644 --- a/src/pdfquick/qquickpdfnavigationstack.cpp +++ b/src/pdfquick/qquickpdfpagenavigator.cpp @@ -37,26 +37,26 @@ ** ****************************************************************************/ -#include "qquickpdfnavigationstack_p.h" +#include "qquickpdfpagenavigator_p.h" #include <QLoggingCategory> QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qLcNav, "qt.pdf.navigationstack") +Q_LOGGING_CATEGORY(qLcNav, "qt.pdf.pagenavigator") /*! - \qmltype PdfNavigationStack -//! \instantiates QQuickPdfNavigationStack + \qmltype PdfPageNavigator +//! \instantiates QQuickPdfPageNavigator \inqmlmodule QtQuick.Pdf \ingroup pdf \brief History of the destinations visited within a PDF Document. \since 5.15 - PdfNavigationStack remembers which destinations the user has visited in a PDF + PdfPageNavigator remembers which destinations the user has visited in a PDF document, and provides the ability to traverse backward and forward. */ -QQuickPdfNavigationStack::QQuickPdfNavigationStack(QObject *parent) +QQuickPdfPageNavigator::QQuickPdfPageNavigator(QObject *parent) : QObject(parent) { } @@ -64,18 +64,18 @@ QQuickPdfNavigationStack::QQuickPdfNavigationStack(QObject *parent) /*! \internal */ -QQuickPdfNavigationStack::~QQuickPdfNavigationStack() = default; +QQuickPdfPageNavigator::~QQuickPdfPageNavigator() = default; /*! \internal */ -QPdfNavigationStack *QQuickPdfNavigationStack::navStack() +QPdfPageNavigator *QQuickPdfPageNavigator::navStack() { - return static_cast<QPdfNavigationStack *>(qmlExtendedObject(this)); + return static_cast<QPdfPageNavigator *>(qmlExtendedObject(this)); } /*! - \qmlmethod void PdfNavigationStack::forward() + \qmlmethod void PdfPageNavigator::forward() Goes back to the page, location and zoom level that was being viewed before back() was called, and then emits the \l jumped() signal. @@ -86,7 +86,7 @@ QPdfNavigationStack *QQuickPdfNavigationStack::navStack() */ /*! - \qmlmethod void PdfNavigationStack::back() + \qmlmethod void PdfPageNavigator::back() Pops the stack, updates the \l currentPage, \l currentLocation and \l currentZoom properties to the most-recently-viewed destination, and then @@ -94,26 +94,26 @@ QPdfNavigationStack *QQuickPdfNavigationStack::navStack() */ /*! - \qmlproperty int PdfNavigationStack::currentPage + \qmlproperty int PdfPageNavigator::currentPage This property holds the current page that is being viewed. If there is no current page, it holds \c -1. */ /*! - \qmlproperty point PdfNavigationStack::currentLocation + \qmlproperty point PdfPageNavigator::currentLocation This property holds the current location on the page that is being viewed. */ /*! - \qmlproperty real PdfNavigationStack::currentZoom + \qmlproperty real PdfPageNavigator::currentZoom This property holds the magnification scale on the page that is being viewed. */ /*! - \qmlmethod void PdfNavigationStack::jump(int page, point location, qreal zoom, bool emitJumped) + \qmlmethod void PdfPageNavigator::jump(int page, point location, qreal zoom, bool emitJumped) Adds the given destination, consisting of \a page, \a location, and \a zoom, to the history of visited locations. If \a emitJumped is \c false, the @@ -125,7 +125,7 @@ QPdfNavigationStack *QQuickPdfNavigationStack::navStack() */ /*! - \qmlmethod void PdfNavigationStack::update(int page, point location, qreal zoom) + \qmlmethod void PdfPageNavigator::update(int page, point location, qreal zoom) Modifies the current destination, consisting of \a page, \a location and \a zoom. @@ -141,21 +141,21 @@ QPdfNavigationStack *QQuickPdfNavigationStack::navStack() */ /*! - \qmlproperty bool PdfNavigationStack::backAvailable + \qmlproperty bool PdfPageNavigator::backAvailable \readonly Holds \c true if a \e back destination is available in the history. */ /*! - \qmlproperty bool PdfNavigationStack::forwardAvailable + \qmlproperty bool PdfPageNavigator::forwardAvailable \readonly Holds \c true if a \e forward destination is available in the history. */ /*! - \qmlsignal PdfNavigationStack::jumped(int page, point location, qreal zoom) + \qmlsignal PdfPageNavigator::jumped(int page, point location, qreal zoom) This signal is emitted when an abrupt jump occurs, to the specified \a page index, \a location on the page, and \a zoom level; but \e not when simply diff --git a/src/pdfquick/qquickpdfnavigationstack_p.h b/src/pdfquick/qquickpdfpagenavigator_p.h index 8d5958259..b3c1c7ceb 100644 --- a/src/pdfquick/qquickpdfnavigationstack_p.h +++ b/src/pdfquick/qquickpdfpagenavigator_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QQUICKPDFNAVIGATIONSTACK_P_H -#define QQUICKPDFNAVIGATIONSTACK_P_H +#ifndef QQUICKPDFPAGENAVIGATOR_P_H +#define QQUICKPDFPAGENAVIGATOR_P_H // // W A R N I N G @@ -52,32 +52,32 @@ // #include <QtPdfQuick/private/qtpdfquickglobal_p.h> -#include <QtPdf/qpdfnavigationstack.h> +#include <QtPdf/qpdfpagenavigator.h> #include <QtPdf/private/qpdflink_p.h> #include <QQmlEngine> QT_BEGIN_NAMESPACE -class Q_PDFQUICK_EXPORT QQuickPdfNavigationStack : public QObject +class Q_PDFQUICK_EXPORT QQuickPdfPageNavigator : public QObject { Q_OBJECT - QML_EXTENDED(QPdfNavigationStack) - QML_NAMED_ELEMENT(PdfNavigationStack) + QML_EXTENDED(QPdfPageNavigator) + QML_NAMED_ELEMENT(PdfPageNavigator) QML_ADDED_IN_VERSION(5, 15) public: - explicit QQuickPdfNavigationStack(QObject *parent = nullptr); - ~QQuickPdfNavigationStack() override; + explicit QQuickPdfPageNavigator(QObject *parent = nullptr); + ~QQuickPdfPageNavigator() override; private: - QPdfNavigationStack *navStack(); + QPdfPageNavigator *navStack(); - Q_DISABLE_COPY(QQuickPdfNavigationStack) + Q_DISABLE_COPY(QQuickPdfPageNavigator) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QQuickPdfNavigationStack) +QML_DECLARE_TYPE(QQuickPdfPageNavigator) -#endif // QQUICKPDFNAVIGATIONSTACK_P_H +#endif // QQUICKPDFPAGENAVIGATOR_P_H |