Opened 14 years ago

Closed 5 years ago

#200 closed defect (wontfix)

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:
Cc:

Description

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 (3)

comment:1 by Dmitry A. Kuminov, 14 years ago

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 by Yagiza, 14 years ago

Ok. Here's sample code:

QShortcut *FSendShortcut;
QTextEdit *editor;

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

FSendShortcut = new QShortcut(editor);
FSendShortcut->setContext(Qt::WidgetShortcut);

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!

connect(FSendShortcut,SIGNAL(activated()),SLOT(onShortcutActivated()));

comment:3 by Silvan Scherrer, 5 years ago

Resolution: wontfix
Status: newclosed

if this is still the case in Qt5 open a ticket at https://github.com/bitwiseworks/qtbase-os2

Note: See TracTickets for help on using tickets.