From 5731bd049da7e31889c1a1e1e23825219db38c1c Mon Sep 17 00:00:00 2001 From: Benjamin Long Date: Mon, 30 Jan 2012 14:00:28 -0500 Subject: [PATCH] Make sure recorded delta associated with MouseWheel are +/-120 The delta associated with Qt Mouse Wheel is sometimes greater than 120 (for example when the wheel is turned very fast). This is expected. From our observation, it seems additional event are also emitted/recorded. Further investigation are needed to exactly identified the issue. The CTK issue #132 will allow us to track that problem. --- pqAbstractItemViewEventTranslator.cxx | 2 +- pqBasicWidgetEventTranslator.cxx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pqAbstractItemViewEventTranslator.cxx b/pqAbstractItemViewEventTranslator.cxx index be53439..37254ea 100644 --- a/pqAbstractItemViewEventTranslator.cxx +++ b/pqAbstractItemViewEventTranslator.cxx @@ -151,7 +151,7 @@ bool pqAbstractItemViewEventTranslator::translateEvent(QObject* Object, QEvent* idxStr = toIndexStr(idx); QRect r = object->visualRect(idx); relPt = wheelEvent->pos() - r.topLeft(); - int numStep = wheelEvent->delta(); + int numStep = wheelEvent->delta() > 0 ? 120 : -120; int buttons = wheelEvent->buttons(); int modifiers = wheelEvent->modifiers(); emit emit recordEvent(Object, "mouseWheel", QString("%1,%2,%3,%4,%5") diff --git a/pqBasicWidgetEventTranslator.cxx b/pqBasicWidgetEventTranslator.cxx index 05f64a5..9e46df8 100644 --- a/pqBasicWidgetEventTranslator.cxx +++ b/pqBasicWidgetEventTranslator.cxx @@ -102,8 +102,9 @@ bool pqBasicWidgetEventTranslator::translateEvent(QObject* Object, { int buttons = wheelEvent->buttons(); int modifiers = wheelEvent->modifiers(); + int numStep = wheelEvent->delta() > 0 ? 120 : -120; emit emit recordEvent(Object, "mouseWheel", QString("%1,%2,%3,%4,%5") - .arg(wheelEvent->delta()) + .arg(numStep) .arg(buttons) .arg(modifiers) .arg(wheelEvent->x()) -- GitLab