Skip to content

Instantly share code, notes, and snippets.

@Jaa-c
Created March 13, 2014 20:43
Show Gist options
  • Select an option

  • Save Jaa-c/9536585 to your computer and use it in GitHub Desktop.

Select an option

Save Jaa-c/9536585 to your computer and use it in GitHub Desktop.
virtual bool eventFilter(QObject *obj, QEvent *event);
bool GLWidget::eventFilter(QObject *, QEvent *event) {
switch(event->type()) {
case QEvent::MouseMove:
{
QMouseEvent *e = (QMouseEvent *) event;
controlls->mousePositionChanged(e->x(), e->y());
break;
}
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
{
QMouseEvent *e = (QMouseEvent *) event;
controlls->mouseButtonChanged(e->buttons());
}
case QEvent::KeyPress:
{
QKeyEvent *e = (QKeyEvent *) event;
controlls->keyboardAction(e->key());
}
default:
return false;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment