gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.18k stars 479 forks source link

Incorrect Ctrl key state in GUI #1510

Open osrf-migration opened 9 years ago

osrf-migration commented 9 years ago

Original report (archived issue) by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


we've been experiencing cases where common::KeyEvent 's control variable doesn't get reset on key release

quick workaround for now is to check Qt's control key instead of gazebo one

osrf-migration commented 9 years ago

Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


osrf-migration commented 9 years ago

Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


osrf-migration commented 8 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


Issue #2007 was caused by GLWidget::keyReleaseEvent not being called when a shortcut is released. i.e.:

  1. Press Crtrl -> GLWidget::keyPressEvent is called

  2. Press T -> Shortcut is activated and MainWindow::SelectTopic is called. GLWidget doesn't get the press event.

  3. Release Ctrl and T -> GLWidget doesn't get the release events.

It looks like the shortcut is swallowing the keypress for T. As for the releases, if you do Ctrl+M to open the model editor for example, GLWidget gets the them. So I think that if a shortcut opens a dialog, the dialog is swallowing the releases.

I tried a couple things which didn't work:

I didn't try anything more involved like actually capturing the events on the dialog, because I think that would be a real pain to implement for every dialog we have, and there might be a more elegant solution.

For now, I propose adding a check for QApplication::keyboardModifiers() to fix issue #2007 on pull request #2398.

Another fun fact: Qt provides API to get the currently pressed keyboard modifiers, but to check for other keys, we have to filter events. Which is what we're doing... and gets messed up with dialogs...

osrf-migration commented 8 years ago

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).