summaryrefslogtreecommitdiffstats
path: root/examples/pdf
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-02-18 21:42:35 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-02-20 09:48:59 +0100
commitf467edc97e66727be7fa3747913e4e01672d4b71 (patch)
treed55afd400b398585006bbdf092230b053a3358da /examples/pdf
parent1acd9ad2bfa1c54f19fa8a71fb41e8a90233f76b (diff)
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 <shawn.rutledge@qt.io>
Diffstat (limited to 'examples/pdf')
-rw-r--r--examples/pdf/multipage/viewer.qml6
1 files changed, 3 insertions, 3 deletions
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
}
}