diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-01-22 00:56:16 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-02-03 23:44:03 +0100 |
commit | 7cf69cb52d434f5e74619b0577104d05688b0c22 (patch) | |
tree | d0d60f971c59087b7f353123df5233a3e2343b3b /examples | |
parent | a8e4ad7726f1aa52624a0367558650cd4d899c79 (diff) |
Add PdfNavigationStack for forward/back navigation
Works well enough to use, but needs autotests and at least one fix.
Change-Id: I2114b9fb3b5ddf7cfe2106d4a4fbc7d74852c61d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pdf/pdfviewer/viewer.qml | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/examples/pdf/pdfviewer/viewer.qml b/examples/pdf/pdfviewer/viewer.qml index 1cf0b432b..b0cd8985d 100644 --- a/examples/pdf/pdfviewer/viewer.qml +++ b/examples/pdf/pdfviewer/viewer.qml @@ -57,8 +57,8 @@ import Qt.labs.platform 1.1 as Platform ApplicationWindow { id: root - width: 800 - height: 640 + width: 1280 + height: 1024 color: "lightgrey" title: document.title visible: true @@ -125,12 +125,22 @@ ApplicationWindow { onTriggered: pageView.rotation += 90 } } + ToolButton { + action: Action { + icon.source: "resources/go-previous-view-page.svg" + enabled: pageView.backEnabled + onTriggered: pageView.back() + } + ToolTip.visible: enabled && hovered + ToolTip.delay: 2000 + ToolTip.text: "go back" + } SpinBox { id: currentPageSB from: 1 to: document.pageCount - value: 1 editable: true + onValueChanged: pageView.currentPage = value - 1 Shortcut { sequence: StandardKey.MoveToPreviousPage onActivated: currentPageSB.value-- @@ -142,6 +152,16 @@ ApplicationWindow { } ToolButton { action: Action { + icon.source: "resources/go-next-view-page.svg" + enabled: pageView.forwardEnabled + onTriggered: pageView.forward() + } + ToolTip.visible: enabled && hovered + ToolTip.delay: 2000 + ToolTip.text: "go forward" + } + ToolButton { + action: Action { shortcut: StandardKey.Copy icon.source: "resources/edit-copy.svg" enabled: pageView.selectedText !== "" @@ -203,7 +223,10 @@ ApplicationWindow { PdfPageView { id: pageView - currentPage: currentPageSB.value - 1 +// currentPage: currentPageSB.value - 1 + // TODO should work but ends up being NaN in QQuickSpinBoxPrivate::setValue() (?!) +// onCurrentPageChanged: currentPageSB.value = pageView.currrentPage + 1 + onCurrentPageReallyChanged: currentPageSB.value = page + 1 document: PdfDocument { id: document onStatusChanged: if (status === PdfDocument.Error) errorDialog.open() |