+ Thomas Anderson's patch for spacenav

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5242 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer
2011-12-09 11:29:51 +00:00
parent a5c8113aaa
commit 012e50c524
6 changed files with 123 additions and 56 deletions

View File

@@ -80,15 +80,31 @@ void Gui::GUIApplicationNativeEventAware::initSpaceball(QMainWindow *window)
bool Gui::GUIApplicationNativeEventAware::processSpaceballEvent(QObject *object, QEvent *event)
{
Spaceball::ButtonEvent *ballEvent = dynamic_cast<Spaceball::ButtonEvent *>(event);
if (!ballEvent)
return true;
QApplication::notify(object, ballEvent);
if (!ballEvent->isHandled())
QApplication::notify(object, event);
if (event->type() == Spaceball::MotionEvent::MotionEventType)
{
//make a new event and post to parent.
Spaceball::ButtonEvent *newEvent = new Spaceball::ButtonEvent(*ballEvent);
postEvent(object->parent(), newEvent);
Spaceball::MotionEvent *motionEvent = dynamic_cast<Spaceball::MotionEvent*>(event);
if (!motionEvent)
return true;
if (!motionEvent->isHandled())
{
//make a new event and post to parent.
Spaceball::MotionEvent *newEvent = new Spaceball::MotionEvent(*motionEvent);
postEvent(object->parent(), newEvent);
}
}
if (event->type() == Spaceball::ButtonEvent::ButtonEventType)
{
Spaceball::ButtonEvent *buttonEvent = dynamic_cast<Spaceball::ButtonEvent*>(event);
if (!buttonEvent)
return true;
if (!buttonEvent->isHandled())
{
//make a new event and post to parent.
Spaceball::ButtonEvent *newEvent = new Spaceball::ButtonEvent(*buttonEvent);
postEvent(object->parent(), newEvent);
}
}
return true;
}