diff --git a/pqAbstractItemViewEventPlayer.cxx b/pqAbstractItemViewEventPlayer.cxx index 86c2ed863526cf7616fe737b79f42bee209985a2..cddd18e4ea478a9ebfe3be740961bf362da823b1 100644 --- a/pqAbstractItemViewEventPlayer.cxx +++ b/pqAbstractItemViewEventPlayer.cxx @@ -40,6 +40,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "pqEventDispatcher.h" @@ -152,7 +153,6 @@ bool pqAbstractItemViewEventPlayer::playEvent(QObject* Object, const QString& Co QStringList args = Arguments.split(','); if(args.size() == 6) { - Qt::MouseButton button = static_cast(args[0].toInt()); Qt::MouseButtons buttons = static_cast(args[1].toInt()); Qt::KeyboardModifiers keym = static_cast(args[2].toInt()); int x = args[3].toInt(); @@ -178,7 +178,15 @@ bool pqAbstractItemViewEventPlayer::playEvent(QObject* Object, const QString& Co QRect r = object->visualRect(idx); pt = r.topLeft() + QPoint(x,y); } - + if (Command == "mouseWheel") + { +// QEvent::Type type = QEvent::Wheel; + int delta = args[0].toInt(); + QWheelEvent we(QPoint(x,y), delta, buttons, keym); + QCoreApplication::sendEvent(Object, &we); + return true; + } + Qt::MouseButton button = static_cast(args[0].toInt()); QEvent::Type type = QEvent::MouseButtonPress; type = Command == "mouseMove" ? QEvent::MouseMove : type; type = Command == "mouseRelease" ? QEvent::MouseButtonRelease : type; diff --git a/pqAbstractItemViewEventTranslator.cxx b/pqAbstractItemViewEventTranslator.cxx index 52048c42e26e7f18d900b19b7f9421d2f63b4b2b..be53439974209f7be7ea940513837858b749981c 100644 --- a/pqAbstractItemViewEventTranslator.cxx +++ b/pqAbstractItemViewEventTranslator.cxx @@ -136,6 +136,34 @@ bool pqAbstractItemViewEventTranslator::translateEvent(QObject* Object, QEvent* emit recordEvent(object, "mouseRelease", info); } } + case QEvent::Wheel: + { + if(Object == object) + { + return false; + } + QPoint relPt = QPoint(0,0); + QWheelEvent* wheelEvent = dynamic_cast(Event); + if(wheelEvent) + { + QString idxStr; + QModelIndex idx = object->indexAt(wheelEvent->pos()); + idxStr = toIndexStr(idx); + QRect r = object->visualRect(idx); + relPt = wheelEvent->pos() - r.topLeft(); + int numStep = wheelEvent->delta(); + int buttons = wheelEvent->buttons(); + int modifiers = wheelEvent->modifiers(); + emit emit recordEvent(Object, "mouseWheel", QString("%1,%2,%3,%4,%5") + .arg(numStep) + .arg(buttons) + .arg(modifiers) + .arg(relPt.x()) + .arg(relPt.y()) + .arg(idxStr)); + } + } + break; default: break; } diff --git a/pqBasicWidgetEventPlayer.cxx b/pqBasicWidgetEventPlayer.cxx index 836420b00f5b8bb6492ffbcf2dcd192cc6995139..d25d95e1e07ff159b8c317ffea526da8e576fa8f 100644 --- a/pqBasicWidgetEventPlayer.cxx +++ b/pqBasicWidgetEventPlayer.cxx @@ -83,12 +83,20 @@ bool pqBasicWidgetEventPlayer::playEvent(QObject* Object, QStringList args = Arguments.split(','); if(args.size() == 5) { - Qt::MouseButton button = static_cast(args[0].toInt()); Qt::MouseButtons buttons = static_cast(args[1].toInt()); Qt::KeyboardModifiers keym = static_cast(args[2].toInt()); int x = args[3].toInt(); int y = args[4].toInt(); QPoint pt(x,y); + if (Command == "mouseWheel") + { + // QEvent::Type type = QEvent::Wheel; + int delta = args[0].toInt(); + QWheelEvent we(QPoint(x,y), delta, buttons, keym); + QCoreApplication::sendEvent(Object, &we); + return true; + } + Qt::MouseButton button = static_cast(args[0].toInt()); QEvent::Type type = QEvent::MouseButtonPress; type = Command == "mouseMove" ? QEvent::MouseMove : type; type = Command == "mouseRelease" ? QEvent::MouseButtonRelease : type; diff --git a/pqBasicWidgetEventTranslator.cxx b/pqBasicWidgetEventTranslator.cxx index 25ed994054ee322457b6991a87fb73eecf1b1469..05f64a56da7308eea9460837756961195bfaa70c 100644 --- a/pqBasicWidgetEventTranslator.cxx +++ b/pqBasicWidgetEventTranslator.cxx @@ -95,6 +95,22 @@ bool pqBasicWidgetEventTranslator::translateEvent(QObject* Object, } } break; + case QEvent::Wheel: + { + QWheelEvent* wheelEvent = dynamic_cast(Event); + if(wheelEvent) + { + int buttons = wheelEvent->buttons(); + int modifiers = wheelEvent->modifiers(); + emit emit recordEvent(Object, "mouseWheel", QString("%1,%2,%3,%4,%5") + .arg(wheelEvent->delta()) + .arg(buttons) + .arg(modifiers) + .arg(wheelEvent->x()) + .arg(wheelEvent->y())); + } + } + break; default: break; }