summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-02-03 18:11:16 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-02-04 17:27:18 +0000
commit25a371caa376c513f22d5c01e425a18629657fdc (patch)
tree4b50ee8135c7d92621685739a433348a8b6a6409 /examples
parent130b058352077b88f8839871f88c226e3e1fa705 (diff)
Add zoom and rotation to PdfMultiPageView
Currently, scaleToWidth() and scaleToPage() choose the scale of the first page to fit the given viewport size, and as long as all pages are the same size, it works. On the other hand, the PinchHandler only affects the scale of the page on which the pinch gesture occurs. Calling resetScale(), scaleToWidth() or scaleToPage() undoes the effect of any previous pinch gesture or any other kind of scaling change. Task-number: QTBUG-77513 Change-Id: Ia3227ca9c4af263eb8505dbd6336657984c66ab0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/pdf/multipage/viewer.qml13
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/pdf/multipage/viewer.qml b/examples/pdf/multipage/viewer.qml
index d20ad4a5b..77c06f80f 100644
--- a/examples/pdf/multipage/viewer.qml
+++ b/examples/pdf/multipage/viewer.qml
@@ -75,11 +75,10 @@ ApplicationWindow {
onTriggered: fileDialog.open()
}
}
- /* TODO zoom & rotation
ToolButton {
action: Action {
shortcut: StandardKey.ZoomIn
- enabled: view.sourceSize.width < 10000
+ enabled: view.renderScale < 10
icon.source: "resources/zoom-in.svg"
onTriggered: view.renderScale *= Math.sqrt(2)
}
@@ -87,7 +86,7 @@ ApplicationWindow {
ToolButton {
action: Action {
shortcut: StandardKey.ZoomOut
- enabled: view.sourceSize.width > 50
+ enabled: view.renderScale > 0.1
icon.source: "resources/zoom-out.svg"
onTriggered: view.renderScale /= Math.sqrt(2)
}
@@ -115,17 +114,16 @@ ApplicationWindow {
action: Action {
shortcut: "Ctrl+L"
icon.source: "resources/rotate-left.svg"
- onTriggered: view.rotation -= 90
+ onTriggered: view.pageRotation -= 90
}
}
ToolButton {
action: Action {
shortcut: "Ctrl+R"
icon.source: "resources/rotate-right.svg"
- onTriggered: view.rotation += 90
+ onTriggered: view.pageRotation += 90
}
}
- */
ToolButton {
action: Action {
icon.source: "resources/go-previous-view-page.svg"
@@ -269,7 +267,8 @@ ApplicationWindow {
x: 6
property size implicitPointSize: document.pagePointSize(view.currentPage)
text: "page " + (currentPageSB.value) + " of " + document.pageCount +
- " original " + implicitPointSize.width.toFixed(1) + "x" + implicitPointSize.height.toFixed(1)
+ " scale " + view.renderScale.toFixed(2) +
+ " original size " + implicitPointSize.width.toFixed(1) + "x" + implicitPointSize.height.toFixed(1) + " pt"
visible: document.pageCount > 0
}
}