[Qt-interest] About stop processing key events while QLineEdit evaluates
John Weeks
john at wavemetrics.com
Fri Oct 28 17:53:03 CEST 2011
You could use global flags to prevent extraneous processing in focus out events; I have some code like that. But I always cringe at such a solution because it makes the code hard to follow.
In my case, I'm handling things like Enter and arrow keys, so I'm pretty much controlling focus myself. I found that after adding sufficient filtering code, I no longer needed to handle focus out events.
Without more detail, we will just have a long-winded discussion :)
Regards, John Weeks
On 27-Oct-2011, at 10:51 PM, Zeljko wrote:
> John Weeks wrote:
>
>> I have a similar situation of a QLineEdit in a spread-sheet-like window where
>> I need to control what happens with certain key events. I installed an event
>> filter on the QLineEdit, check for key press events, and check the key codes.
>> If they are key codes I want to control, I handle them there and block the
>> event going to the QLineEdit.
>
> Yes, I already have that, but point is that pressing eg return key in my case
> selects next lineedit, so this one is loosing focus and then I evaluate it.
> I think that I must make some kind of lock (eg. bool) in application event
> filter so when evaluated edit starts evaluation it sets lock to true, and when
> eval is finished it returns lock in normal state. So then in app event filter I
> need to check such lock and bypass repeated keypresses until lock becomes false
> ... that's current idea...I'll try to implement it like that and see if that
> scenario helps.
>
> zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111028/d58754b4/attachment.html
More information about the Qt-interest-old
mailing list