Properly check Shift toggling in DolphinRemoveAction

Review Request #128972 - Created Sept. 21, 2016 and submitted

Information
Elvis Angelaccio
dolphin
Applications/16.08
354301
8279fa3...
Reviewers
dolphin
emmanuelp

Documentation of QGuiApplication::keyboardModifiers() says:

The current state is updated sychronously as the event queue is emptied of events that will spontaneously change the keyboard state (QEvent::KeyPress and QEvent::KeyRelease events).
It should be noted this may not reflect the actual keys held on the input device at the time of calling but rather the modifiers as last reported in one of the above events.

Since this method is called in DolphinContextMenu's keyPressEvent() and keyReleaseEvent(), the first time that keyboardModifiers() is called it doesn't report that shift has been pressed.

Replacing this method with queryKeyboardModifiers() does the job because the latter doesn't care about the event queue.

Another solution could be adding a bool isShiftPressed argument to DolphinRemoveAction::update() and setting it to true in keyPressEvent() and false in keyReleaseEvent(). The problem is that update() is called also in other places, so it would become quite ugly...

Toggling Shift when the context menu is open now works as expected.

Wolfgang Bauer
Emmanuel Pescosta
Elvis Angelaccio
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 3775ef19eaca057985b92cfa3716d3c3a1d22f0f by Elvis Angelaccio to branch Applications/16.08.
Loading...