Commit d294872b authored by Shawn Rutledge's avatar Shawn Rutledge
Browse files

Enable mouse wheel scrolling in single-page PdfPageView


Change-Id: I20512187dcc872b2e0429968e9ad2a9899aee6c2
Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
Showing with 26 additions and 0 deletions
...@@ -53,6 +53,7 @@ import QtQuick.Layouts 1.14 ...@@ -53,6 +53,7 @@ import QtQuick.Layouts 1.14
import QtQuick.Pdf 5.15 import QtQuick.Pdf 5.15
import QtQuick.Shapes 1.14 import QtQuick.Shapes 1.14
import QtQuick.Window 2.14 import QtQuick.Window 2.14
import Qt.labs.animation 1.0
import Qt.labs.platform 1.1 as Platform import Qt.labs.platform 1.1 as Platform
ApplicationWindow { ApplicationWindow {
...@@ -208,6 +209,21 @@ ApplicationWindow { ...@@ -208,6 +209,21 @@ ApplicationWindow {
searchString: searchField.text 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 { Drawer {
id: searchDrawer id: searchDrawer
edge: Qt.LeftEdge edge: Qt.LeftEdge
......
...@@ -37,6 +37,7 @@ import QtQuick 2.14 ...@@ -37,6 +37,7 @@ import QtQuick 2.14
import QtQuick.Controls 2.14 import QtQuick.Controls 2.14
import QtQuick.Pdf 5.15 import QtQuick.Pdf 5.15
import QtQuick.Shapes 1.14 import QtQuick.Shapes 1.14
import Qt.labs.animation 1.0
Rectangle { Rectangle {
// public API // public API
...@@ -260,4 +261,13 @@ Rectangle { ...@@ -260,4 +261,13 @@ Rectangle {
id: tapHandler id: tapHandler
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus 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
}
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment