Opened 7 years ago

Last modified 7 years ago

#200 new defect

QTextEdit (and maybe other widget classes) consumes keyboard shortcuts

Reported by: Yagiza Owned by:
Priority: major Milestone: Qt Enhanced
Component: QtGui Version: 4.6.3
Severity: low Keywords:


When I have a widget with QTextEdit class in the window and add a keyoard shortcut (QShortcut) to it with key sequence (QKeySequence) it already handles (with Return, Backspace or other special keys) the shortcut do not trigger and default action preformed instead. This happens with any key combination which contains handled special keys (for example Ctrl+Return also doesn't work).
In both windows and linux those shortcuts works all right.

Change History (2)

comment:1 Changed 7 years ago by dmik

Yagiza, thank you for the report! Could you please provide a simple test case for this problem? I'm focused on a different project ATM and don't have much time to work on Qt.

comment:2 Changed 7 years ago by Yagiza

Ok. Here's sample code:

QShortcut *FSendShortcut;
QTextEdit *editor;

/* here goes some code to obtain pointer to QTextEdit oject */

FSendShortcut = new QShortcut(editor);

FSendShortcut->setKey(Qt::Key_Return); // The signal below will never trigger!
// FSendShortcut->setKey(Qt::CTRL + Qt::Key_Return); // In this case the signal won't trigger also!
// FSendShortcut->setKey(Qt::Key_Backspace); // In this case the signal won't trigger also!
// FSendShortcut->setKey(Qt::Key_F12); // And in this case the signal will trigger all right, 'cause QTextEdit do not handle F12 key!

Note: See TracTickets for help on using tickets.