aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-11-30 16:21:58 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-11-30 15:32:20 +0000
commiteac395fed121d09e39abcb322c508aa49c467074 (patch)
treeaaba35b7652c73d081f883856f40965dced90260 /examples
parent86a8bcede091d0afe15c26b6fb2efcbf5989c13b (diff)
Update examples to deal correctly with fine-grained wheel events
Zooming in large steps on every wheel-events breaks with fine-grained wheel events like we get on touch-pads. We should therefore not encourage that in our examples. Change-Id: Ie2e70b91c66c73f12ef1f6cd55c8610ae70b36ed Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/mousearea/mousearea-wheel-example.qml7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/quick/mousearea/mousearea-wheel-example.qml b/examples/quick/mousearea/mousearea-wheel-example.qml
index ca6518ec4b..861639811c 100644
--- a/examples/quick/mousearea/mousearea-wheel-example.qml
+++ b/examples/quick/mousearea/mousearea-wheel-example.qml
@@ -64,10 +64,9 @@ Rectangle {
anchors.fill: parent
onWheel: {
if (wheel.modifiers & Qt.ControlModifier) {
- if (wheel.angleDelta.y > 0)
- parent.scaleFactor += 0.2;
- else if (parent.scaleFactor - 0.2 >= 0.2)
- parent.scaleFactor -= 0.2;
+ parent.scaleFactor += 0.2 * wheel.angleDelta.y / 120;
+ if (parent.scaleFactor < 0)
+ parent.scaleFactor = 0;
}
}
}