[Development] QKeySequenceEdit: Unable to assign tab

Laszlo Papp lpapp at kde.org
Fri Jun 24 18:56:17 CEST 2022


Ah, I think I found the issue. QKeySequence::event() falls back to
QWidget::event() for KeyPress event types and QWidget::event() treats the
tabs as special here:
https://code.woboq.org/qt5/qtbase/src/widgets/kernel/qwidget.cpp.html#9006

However, this logic should not inherently apply to QKeySequenceEdit, so I
think QKeySequenceEdit::event() needs to take charge for key presses. Would
this be acceptable if I push this to gerrit?

git diff src/widgets/widgets/qkeysequenceedit.cpp
diff --git a/src/widgets/widgets/qkeysequenceedit.cpp
b/src/widgets/widgets/qkeysequenceedit.cpp
index 3dafb9396b..393e93e949 100644
--- a/src/widgets/widgets/qkeysequenceedit.cpp
+++ b/src/widgets/widgets/qkeysequenceedit.cpp
@@ -218,6 +218,9 @@ bool QKeySequenceEdit::event(QEvent *e)
     case QEvent::ShortcutOverride:
         e->accept();
         return true;
+    case QEvent::KeyPress:
+        keyPressEvent(dynamic_cast<QKeyEvent *>(e));
+        return true;
     default :
         break;
     }

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20220624/9e2edd43/attachment-0001.htm>


More information about the Development mailing list