[Kmymoney-devel] Why Enter does not enter
Fernando Vilas
fvilas at iname.com
Mon Nov 2 04:04:52 CET 2009
On Sunday 01 November 2009 20:16:06 Alvaro Soliverez wrote:
> Hello all,
> I found why that is.
>
> During the port, the KeyButtonMask, which is used to check when a key is
> part of the modifiers (Alt, Shift, etc) was ported to KeyboardModifierMask.
> Unfortunately, that mask now contains the KeypadModifier, which informs
> whether a keypad key was pressed.
> That results in this piece of code in transactioneditor never returning
> true when the keypad Enter is pressed:
>
> line 164:
>
> if(o->isWidgetType()
>
> && (e->type() == QEvent::KeyPress)
>
> && m_editWidgets.values().contains(dynamic_cast<QWidget*>(o))) {
>
> QKeyEvent* k = dynamic_cast<QKeyEvent*>(e);
>
> if((k->modifiers() & Qt::KeyboardModifierMask) == 0) {
>
>
> I tried this and it works, but I want to check if there is a nicer way:
>
> if((k->modifiers() & Qt::KeyboardModifierMask) == 0
>
> || (k->modifiers() & Qt::KeypadModifier) != 0) {
>
It looks like you could get away with only using the check for
Qt::KeypadModifier. The Qt docs don't mention the other one, so I have to
assume it was left over from Qt3, where one had to filter based on keyboard or
mouse inputs. When they changed from k->state() to k->modifiers(), I think that
went away.
--
Thanks,
Fernando Vilas
fvilas at iname.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20091101/3a4626fb/attachment.sig
More information about the KMyMoney-devel
mailing list