[Qt-interest] About stop processing key events while QLineEdit evaluates
Zeljko
zeljko at holobit.net
Sat Oct 29 08:37:48 CEST 2011
John Weeks wrote:
> 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 :)
Ok, I've fixed it without touching app event filter.
1 bool and code in QLineEdit keypress and focus out event works fine.
When return is pressed I don't imediatelly select next control,
but setting bool Evaluating = True (while this is true and another return key
comes it just bypasses , so no jumping to other control) and call function which
does evaluation in focus out. If result of that routine == false, then I don't
select next control but stay in current line edit, otherwise i select next
control but during call to selection of next control, I disconnect evaluator of
current qlineedit and connect it again after selection passes.
Works like charm ...
Thanks for hints.
zeljko
More information about the Qt-interest-old
mailing list