[Qt-interest] Problem with ENTER as keyboard shortcut for QAction
MP
singularita at gmail.com
Fri Jul 24 02:40:25 CEST 2009
I have application with numerous single letter (F, H, I, ....)
keyboard shortcuts assigned to QActions. When I press them,
appropriate QAction are invoked.
I have one QLineEdit control (a "console"), when it have focus, the
keys go (correctly) to the edit control - typing them will alter the
text without invoking the QActrions. Pressing the Return (Enter) key
while in QlineEdit will cause returnPressed() to be emitted. So far
everything is good. BUT, if I have set "Return" as keyboard shortcut
for some QAction - then pressing Return will invoke that QAction, even
if QLineEdit have focus. And returnPressed() is never emitted.
Is it possible to set up QLineEdit, so that it when Enter is pressed,
it will be "eaten" by the control (only if it have focus) instead of
invoking corresponding QAction? As it is done for typing regular
letters ...
I am using Qt 4.5.2 currently.
Martin
More information about the Qt-interest-old
mailing list