[Kmymoney-devel] Why Enter does not enter
Alvaro Soliverez
asoliverez at gmail.com
Mon Nov 2 04:14:14 CET 2009
On Mon, Nov 2, 2009 at 12:04 AM, Fernando Vilas <fvilas at iname.com> wrote:
> 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.
>
>
Not really, because you want to enter that loop if a key was entered, as
long as it is not an ordinary modifier (Alt, Shift, etc.).
If there is a mask that includes modifiers but excludes the keypad modifier,
that's what we should use.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kmymoney-devel/attachments/20091102/44b949ec/attachment.htm
More information about the KMyMoney-devel
mailing list