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/qml | |
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/qml')
-rw-r--r-- | src/pdf/quick/qml/PdfMultiPageView.qml | 4 | ||||
-rw-r--r-- | src/pdf/quick/qml/PdfPageView.qml | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/pdf/quick/qml/PdfMultiPageView.qml b/src/pdf/quick/qml/PdfMultiPageView.qml index 28436b90d..be41153b6 100644 --- a/src/pdf/quick/qml/PdfMultiPageView.qml +++ b/src/pdf/quick/qml/PdfMultiPageView.qml @@ -111,7 +111,7 @@ Item { property bool rot90: rotationModulus > 45 && rotationModulus < 135 property size firstPagePointSize: document.pagePointSize(0) onCurrentIndexChanged: { - navigationStack.currentPage = currentIndex + navigationStack.push(currentIndex, Qt.point(0, 0), root.renderScale) root.currentPageReallyChanged(currentIndex) } delegate: Rectangle { @@ -244,7 +244,7 @@ Item { } PdfNavigationStack { id: navigationStack - onCurrentPageJumped: listView.currentIndex = page + onJumped: listView.currentIndex = page onCurrentPageChanged: root.currentPageReallyChanged(navigationStack.currentPage) } } diff --git a/src/pdf/quick/qml/PdfPageView.qml b/src/pdf/quick/qml/PdfPageView.qml index cf287ecf7..d03e9dc9d 100644 --- a/src/pdf/quick/qml/PdfPageView.qml +++ b/src/pdf/quick/qml/PdfPageView.qml @@ -57,6 +57,7 @@ Rectangle { property alias forwardEnabled: navigationStack.forwardAvailable function back() { navigationStack.back() } function forward() { navigationStack.forward() } + function goToPage(page) { navigationStack.push(page, Qt.point(0, 0), renderScale) } signal currentPageReallyChanged(page: int) property real __pageScale: image.paintedWidth / document.pagePointSize(navigationStack.currentPage).width @@ -203,7 +204,7 @@ Rectangle { cursorShape: Qt.PointingHandCursor onClicked: { if (page >= 0) - navigationStack.currentPage = page + navigationStack.push(page, Qt.point(0, 0), paper.renderScale) else Qt.openUrlExternally(url) } |