From d1749c375ea924390d19225b40ef2631b524849b Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 22 Jan 2020 00:08:15 +0100 Subject: Use SpinBox for page navigation to get jump-to-page feature Change-Id: Ic4c7d1a7458995415452e899b3dc369c9fe574f4 Reviewed-by: Shawn Rutledge --- examples/pdf/pdfviewer/viewer.qml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'examples') 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() -- cgit v1.2.3