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

Yuya Nishihara yuya at tcha.org
Sun Oct 18 09:18:16 BST 2015


On Sun, 18 Oct 2015 08:41:58 +0100, Phil Thompson wrote:
> On 17 Oct 2015, at 10:11 a.m., Yuya Nishihara <yuya at tcha.org> wrote:
> > 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_()
> 
> Can you try the current snapshot?

Confirmed the fix, thanks!


More information about the QScintilla mailing list