Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
4.3.0
-
None
Description
A case:
My app have defined Escape shortcut for some action. When I open combobox and press Escape my combobox is not closed but application's action is invoked instead.
The solution:
Accept ShortcutOverride event for Escape key inside combobox. In this way shortcut will not be triggered and combobox will receive its KeyPress event with Escape key.
This is general problem. One could go through all the widgets and fix similar issues.
The patch for combobox and itemdelegate regarding Escape shortcut:
==== //depot/qt/4.3/src/gui/itemviews/qitemdelegate.cpp#5 - /home/jkobus/dev/qt-4.3/src/gui/itemviews/qitemdelegate.cpp ====
@@ -1155,6 +1155,11 @@
emit commitData(editor);
emit closeEditor(editor, NoHint);
}
+ } else if (event->type() == QEvent::ShortcutOverride) {
+ if (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape)
}
return false;
}
==== //depot/qt/4.3/src/gui/widgets/qcombobox.cpp#15 - /home/jkobus/dev/qt-4.3/src/gui/widgets/qcombobox.cpp ====
@@ -544,6 +544,13 @@
break;
}
break;
+ case QEvent::ShortcutOverride: {
+ if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape)
+ break;
+ }
case QEvent::MouseMove: {
if (isVisible()) {
QMouseEvent *m = static_cast<QMouseEvent *>(e);