summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/pdf/pdfviewer/viewer.qml16
-rw-r--r--src/pdf/quick/qml/PdfPageView.qml10
2 files changed, 26 insertions, 0 deletions
diff --git a/examples/pdf/pdfviewer/viewer.qml b/examples/pdf/pdfviewer/viewer.qml
index c63485dd3..586a822a0 100644
--- a/examples/pdf/pdfviewer/viewer.qml
+++ b/examples/pdf/pdfviewer/viewer.qml
@@ -53,6 +53,7 @@ import QtQuick.Layouts 1.14
import QtQuick.Pdf 5.15
import QtQuick.Shapes 1.14
import QtQuick.Window 2.14
+import Qt.labs.animation 1.0
import Qt.labs.platform 1.1 as Platform
ApplicationWindow {
@@ -208,6 +209,21 @@ ApplicationWindow {
searchString: searchField.text
}
+ WheelHandler {
+ rotationScale: 15
+ target: pageView
+ property: "x"
+ orientation: Qt.Horizontal
+ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
+ }
+ WheelHandler {
+ rotationScale: 15
+ target: pageView
+ property: "y"
+ orientation: Qt.Vertical
+ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
+ }
+
Drawer {
id: searchDrawer
edge: Qt.LeftEdge
diff --git a/src/pdf/quick/qml/PdfPageView.qml b/src/pdf/quick/qml/PdfPageView.qml
index ec3cd78e0..dfd00a1a8 100644
--- a/src/pdf/quick/qml/PdfPageView.qml
+++ b/src/pdf/quick/qml/PdfPageView.qml
@@ -37,6 +37,7 @@ import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Pdf 5.15
import QtQuick.Shapes 1.14
+import Qt.labs.animation 1.0
Rectangle {
// public API
@@ -260,4 +261,13 @@ Rectangle {
id: tapHandler
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus
}
+ // prevent it from being scrolled out of view
+ BoundaryRule on x {
+ minimum: 100 - root.width
+ maximum: root.parent.width - 100
+ }
+ BoundaryRule on y {
+ minimum: 100 - root.height
+ maximum: root.parent.height - 100
+ }
}