[QScintilla] [BUG] numpad key not overridden if assigned to shortcut

Yuya Nishihara yuya at tcha.org
Sat Oct 17 10:11:49 BST 2015


Hello,

I got a bug report that says numpad Del key triggers a shortcut event.

https://bitbucket.org/tortoisehg/thg/issues/4317/

Perhaps QsciScintilla::event() have to exclude Qt::KeypadModifier or select
only valid modifiers.

Untested patch:

--- Qt4Qt5/qsciscintilla.cpp.orig	2015-10-17 18:04:26.507849796 +0900
+++ Qt4Qt5/qsciscintilla.cpp	2015-10-17 18:06:55.332284177 +0900
@@ -4231,7 +4231,7 @@
             }
 
             // We want any key that is bound.
-            QsciCommand *cmd = stdCmds->boundTo(ke->key() | ke->modifiers());
+            QsciCommand *cmd = stdCmds->boundTo(ke->key() | (ke->modifiers() & ~Qt::KeypadModifier));
 
             if (cmd)
             {

Step to reproduce:

1. run the following code
2. type something
3. press 'Del' -> works
4. press numpad 'Del' -> nothing happen

from PyQt4.QtGui import QApplication, QShortcut
from PyQt4.Qsci import QsciScintilla

app = QApplication([])
sci = QsciScintilla()
QShortcut('Delete', sci)
sci.show()
app.exec_()


More information about the QScintilla mailing list