<br><br><div class="gmail_quote">On Mon, Nov 2, 2009 at 12:04 AM, Fernando Vilas <span dir="ltr"><<a href="mailto:fvilas@iname.com">fvilas@iname.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Sunday 01 November 2009 20:16:06 Alvaro Soliverez wrote:<br>
> Hello all,<br>
> I found why that is.<br>
><br>
> During the port, the KeyButtonMask, which is used to check when a key is<br>
> part of the modifiers (Alt, Shift, etc) was ported to KeyboardModifierMask.<br>
> Unfortunately, that mask now contains the KeypadModifier, which informs<br>
> whether a keypad key was pressed.<br>
> That results in this piece of code in transactioneditor never returning<br>
> true when the keypad Enter is pressed:<br>
><br>
> line 164:<br>
><br>
> if(o->isWidgetType()<br>
><br>
> && (e->type() == QEvent::KeyPress)<br>
><br>
> && m_editWidgets.values().contains(dynamic_cast<QWidget*>(o))) {<br>
><br>
> QKeyEvent* k = dynamic_cast<QKeyEvent*>(e);<br>
><br>
> if((k->modifiers() & Qt::KeyboardModifierMask) == 0) {<br>
><br>
><br>
> I tried this and it works, but I want to check if there is a nicer way:<br>
><br>
> if((k->modifiers() & Qt::KeyboardModifierMask) == 0<br>
><br>
> || (k->modifiers() & Qt::KeypadModifier) != 0) {<br>
><br>
<br>
</div></div>It looks like you could get away with only using the check for<br>
Qt::KeypadModifier. The Qt docs don't mention the other one, so I have to<br>
assume it was left over from Qt3, where one had to filter based on keyboard or<br>
mouse inputs. When they changed from k->state() to k->modifiers(), I think that<br>
went away.<br>
<font color="#888888"></font><br></blockquote></div><br>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.). <br>If there is a mask that includes modifiers but excludes the keypad modifier, that's what we should use. <br>