Skip to content

Commit

Permalink
Fixed keyRelease event
Browse files Browse the repository at this point in the history
Signed-off-by: ahcorde <[email protected]>
  • Loading branch information
ahcorde committed Aug 13, 2021
1 parent caf08a9 commit e6e3e16
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/gui/plugins/transform_control/TransformControl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,6 @@ bool TransformControl::eventFilter(QObject *_obj, QEvent *_event)
this->activateRotate();
}
}
else if (_event->type() == QEvent::KeyRelease)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(_event);
if (keyEvent->key() == Qt::Key_Escape)
{
this->activateSelect();
}
}
else if (_event->type() ==
ignition::gazebo::gui::events::EntitiesSelected::kType)
{
Expand Down Expand Up @@ -411,6 +403,16 @@ bool TransformControl::eventFilter(QObject *_obj, QEvent *_event)
static_cast<ignition::gui::events::KeyPressOnScene*>(_event);
this->dataPtr->keyEvent = _e->Key();
}
else if (_event->type() == ignition::gui::events::KeyReleaseOnScene::kType)
{
ignition::gui::events::KeyReleaseOnScene *_e =
static_cast<ignition::gui::events::KeyReleaseOnScene*>(_event);
this->dataPtr->keyEvent = _e->Key();
if (this->dataPtr->keyEvent.Key() == Qt::Key_Escape)
{
this->activateSelect();
}
}

return QObject::eventFilter(_obj, _event);
}
Expand Down

1 comment on commit e6e3e16

@chapulina
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to handle KeyPress the same way for consistency?

Please sign in to comment.