diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-01-22 00:08:15 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-01-30 12:46:57 +0100 |
commit | d1749c375ea924390d19225b40ef2631b524849b (patch) | |
tree | f3e30a5ef12231890b8b27881de61114da80b2f3 /examples | |
parent | 6104c716c7677cf705787a0be4ffb0adc2b8b5b8 (diff) |
Use SpinBox for page navigation to get jump-to-page feature
Change-Id: Ic4c7d1a7458995415452e899b3dc369c9fe574f4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pdf/pdfviewer/viewer.qml | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/examples/pdf/pdfviewer/viewer.qml b/examples/pdf/pdfviewer/viewer.qml index adc2a4b5b..8f2603659 100644 --- a/examples/pdf/pdfviewer/viewer.qml +++ b/examples/pdf/pdfviewer/viewer.qml @@ -113,20 +113,19 @@ ApplicationWindow { onTriggered: pageView.rotation += 90 } } - ToolButton { - action: Action { - shortcut: StandardKey.MoveToPreviousPage - icon.source: "resources/go-previous-view-page.svg" - enabled: pageView.currentPage > 0 - onTriggered: pageView.currentPage-- + SpinBox { + id: currentPageSB + from: 1 + to: document.pageCount + value: 1 + editable: true + Shortcut { + sequence: StandardKey.MoveToPreviousPage + onActivated: currentPageSB.value-- } - } - ToolButton { - action: Action { - shortcut: StandardKey.MoveToNextPage - icon.source: "resources/go-next-view-page.svg" - enabled: pageView.currentPage < pageView.pageCount - 1 - onTriggered: pageView.currentPage++ + Shortcut { + sequence: StandardKey.MoveToNextPage + onActivated: currentPageSB.value++ } } TextField { @@ -184,6 +183,7 @@ ApplicationWindow { PdfPageView { id: pageView + currentPage: currentPageSB.value - 1 document: PdfDocument { id: document onStatusChanged: if (status === PdfDocument.Error) errorDialog.open() |