[Development] QtQuickControls Action keyboard shortcuts and keyPressEvent (TextField)

Ola Røer Thorsen ola at silentwings.no
Mon Aug 12 10:54:50 CEST 2013


Hello,

I'm writing a specialized playback application, based on Qt 5.1. The GUI 
is based on QtQuick, and uses the QuickControls. The root window is a 
QQuickWindow, and the base item in the Quick scene is an ApplicationWindow.

I use Action items with keyboard shortcuts defined. This works, but it 
seems like an Action gets the keyboard event before the Quick items 
receive them. This means that if I have a TextField with active focus, 
it will not receive any keyboard key press events if such a key is 
already defined in an Action.

I tried the same setup in a QWidget-based application. There it is no 
problem - I add a QAction to QApplication with a shortcut - it is 
triggered as long as it's not accepted by a text field first.

Example: spacebar is shortcut for a play/pause toggle action. This means 
space cannot be used in a TextField with active focus. It will toggle 
play/pause while you type, and no space appears in the text. Please 
don't tell me I will have to add Ctrl+ to all the shortcuts...

Is this intended behavior in QtQuick? Shouldn't the item with active 
focus get the key press BEFORE any Action?

Thanks,
Ola




More information about the Development mailing list