[QScintilla] [BUG] numpad key not overridden if assigned to shortcut
Phil Thompson
phil at riverbankcomputing.com
Sun Oct 18 08:41:58 BST 2015
On 17 Oct 2015, at 10:11 a.m., Yuya Nishihara <yuya at tcha.org> wrote:
>
> 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_()
Can you try the current snapshot?
Thanks,
Phil
More information about the QScintilla
mailing list