From f467edc97e66727be7fa3747913e4e01672d4b71 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 18 Feb 2020 21:42:35 +0100 Subject: PdfMultiPageView: use TableView; horz. scroll; control page position TableView is missing some features compared to ListView; so finding out where we currently are (which row) and programmatic positioning on a specific y coordinate of a specific row require some workarounds for now, including helpers in PdfDocument. TableView also assumes (and sporadically enforces) that all cells in a column have the same width. So we need a placeholder Item for each page. This also helps with rotation: the placeholder is now as wide as the window or the image, whichever is wider, and the "paper" is centered within; thus there's always room to rotate it. There's still some problem with setting contentY in goToPage() after the page has been zoomed to a size larger than the window: the values look correct, but it scrolls too far. But on the plus side, horizontal scrolling works. So now we attempt to control the horizontal position too: NavigationStack tracks it, and can go back to a previous position; and links can in theory jump to specific positions and zoom levels, scrolling horizontally such that a specific x coordinate is visible. Includes minor UI tweaks to make it look better on iOS. Change-Id: I643d8ef48ef815aeb49cae77dcb84c3682563d56 Reviewed-by: Shawn Rutledge --- examples/pdf/multipage/viewer.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/pdf') diff --git a/examples/pdf/multipage/viewer.qml b/examples/pdf/multipage/viewer.qml index ac6d2cd9a..9e5f92407 100644 --- a/examples/pdf/multipage/viewer.qml +++ b/examples/pdf/multipage/viewer.qml @@ -249,6 +249,7 @@ ApplicationWindow { y: root.header.height height: view.height dim: false + clip: true ListView { id: searchResultsList anchors.fill: parent @@ -286,7 +287,7 @@ ApplicationWindow { TextField { id: searchField placeholderText: "search" - Layout.minimumWidth: 200 + Layout.minimumWidth: 150 Layout.fillWidth: true onAccepted: searchDrawer.open() Image { @@ -316,11 +317,10 @@ ApplicationWindow { } Label { id: statusLabel - Layout.fillWidth: true property size implicitPointSize: document.pagePointSize(view.currentPage) text: "page " + (currentPageSB.value) + " of " + document.pageCount + " scale " + view.renderScale.toFixed(2) + - " original size " + implicitPointSize.width.toFixed(1) + "x" + implicitPointSize.height.toFixed(1) + " pt" + " original " + implicitPointSize.width.toFixed(1) + "x" + implicitPointSize.height.toFixed(1) + " pt" visible: document.pageCount > 0 } } -- cgit v1.2.3