Commit 7f800488 authored by Clinton Stimpson's avatar Clinton Stimpson

BUG: Fix menu playback on the Mac with Qt 4.2.

ENH:  Menu playback no longer uses mouse events (Qt 4.1.3 or greater).
      Which means one no longer has to move the mouse cursor
      out of the way when running tests to prevent
      interference with menu playback.
parent 3e34daca
......@@ -112,6 +112,7 @@ bool pqAbstractActivateEventPlayer::playEvent(QObject* Object,
else if(QMenu* menu = qobject_cast<QMenu*>(p))
#if QT_VERSION < 0x040103
QRect geom = menu->actionGeometry(next->menuAction());
QMouseEvent button_press(QEvent::MouseButtonPress,,
......@@ -124,6 +125,9 @@ bool pqAbstractActivateEventPlayer::playEvent(QObject* Object,,
Qt::LeftButton, 0, 0);
QApplication::sendEvent(menu, &button_release);
......@@ -136,21 +140,13 @@ bool pqAbstractActivateEventPlayer::playEvent(QObject* Object,
// to make action visible
// simulate mouse click on menu item
QRect geom = object->actionGeometry(action);
QMouseEvent button_press(QEvent::MouseButtonPress,,
Qt::LeftButton, Qt::LeftButton, 0);
QApplication::sendEvent(object, &button_press);
QMouseEvent button_release(QEvent::MouseButtonRelease,,
Qt::LeftButton, 0, 0);
QApplication::sendEvent(object, &button_release);
// activate the action item
QKeyEvent keyDown(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
QKeyEvent keyUp(QEvent::KeyRelease, Qt::Key_Enter, Qt::NoModifier);
QApplication::sendEvent(object, &keyDown);
QApplication::sendEvent(object, &keyUp);
// TODO: If mouse happens to be over where a menu shows up
// the mouse messes up the activation of the menu item
return true;
Markdown is supported
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