diff --git a/src/gui/plugins/transform_control/TransformControl.cc b/src/gui/plugins/transform_control/TransformControl.cc index 5433b8d472..ee8eb80963 100644 --- a/src/gui/plugins/transform_control/TransformControl.cc +++ b/src/gui/plugins/transform_control/TransformControl.cc @@ -372,14 +372,6 @@ bool TransformControl::eventFilter(QObject *_obj, QEvent *_event) this->activateRotate(); } } - else if (_event->type() == QEvent::KeyRelease) - { - QKeyEvent *keyEvent = static_cast(_event); - if (keyEvent->key() == Qt::Key_Escape) - { - this->activateSelect(); - } - } else if (_event->type() == ignition::gazebo::gui::events::EntitiesSelected::kType) { @@ -411,6 +403,16 @@ bool TransformControl::eventFilter(QObject *_obj, QEvent *_event) static_cast(_event); this->dataPtr->keyEvent = _e->Key(); } + else if (_event->type() == ignition::gui::events::KeyReleaseOnScene::kType) + { + ignition::gui::events::KeyReleaseOnScene *_e = + static_cast(_event); + this->dataPtr->keyEvent = _e->Key(); + if (this->dataPtr->keyEvent.Key() == Qt::Key_Escape) + { + this->activateSelect(); + } + } return QObject::eventFilter(_obj, _event); }