don't start/end action/back events on auto-repeat

This commit is contained in:
Stephen Birarda 2014-10-28 11:34:31 -07:00
parent a561252908
commit 477b5096e8

View file

@ -1118,18 +1118,22 @@ void Application::keyPressEvent(QKeyEvent* event) {
_myAvatar->resetSize(); _myAvatar->resetSize();
break; break;
case Qt::Key_Space: { case Qt::Key_Space: {
// this starts an HFActionEvent if (!event->isAutoRepeat()) {
HFActionEvent startActionEvent(HFActionEvent::startType(), getViewportCenter()); // this starts an HFActionEvent
sendEvent(this, &startActionEvent); HFActionEvent startActionEvent(HFActionEvent::startType(), getViewportCenter());
sendEvent(this, &startActionEvent);
}
break; break;
} }
case Qt::Key_Escape: { case Qt::Key_Escape: {
OculusManager::abandonCalibration(); OculusManager::abandonCalibration();
// this starts the HFCancelEvent if (!event->isAutoRepeat()) {
HFBackEvent startBackEvent(HFBackEvent::startType()); // this starts the HFCancelEvent
sendEvent(this, &startBackEvent); HFBackEvent startBackEvent(HFBackEvent::startType());
sendEvent(this, &startBackEvent);
}
break; break;
} }
@ -1205,16 +1209,20 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
_myAvatar->clearDriveKeys(); _myAvatar->clearDriveKeys();
break; break;
case Qt::Key_Space: { case Qt::Key_Space: {
// this ends the HFActionEvent if (!event->isAutoRepeat()) {
HFActionEvent endActionEvent(HFActionEvent::endType(), getViewportCenter()); // this ends the HFActionEvent
sendEvent(this, &endActionEvent); HFActionEvent endActionEvent(HFActionEvent::endType(), getViewportCenter());
sendEvent(this, &endActionEvent);
}
break; break;
} }
case Qt::Key_Escape: { case Qt::Key_Escape: {
// this ends the HFCancelEvent if (!event->isAutoRepeat()) {
HFBackEvent endBackEvent(HFBackEvent::endType()); // this ends the HFCancelEvent
sendEvent(this, &endBackEvent); HFBackEvent endBackEvent(HFBackEvent::endType());
sendEvent(this, &endBackEvent);
}
break; break;
} }