[Qt-interest] About stop processing key events while QLineEdit evaluates

John Weeks john at wavemetrics.com
Thu Oct 27 17:46:52 CEST 2011


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.

Look at QObject::installEventFilter and QObject::eventFilter.

On 26-Oct-2011, at 11:21 PM, Zeljko wrote:

> Hi,
> 
> Is there any way to stop key events while QLineEdit evaluates someting in 
> QEvent::FocusOut ?
> 
> This is construction:
> 1. When user press return key it does same job as tab key -> goes to next 
> control.
> 2.FocusOut triggers on focused control -> now there's call to hugedatabase which 
> evaluates something (can be few msecs but also few seconds).
> 
> 3.If user constantly nervously presses return key (or even user pushed return 
> key, so auto repeat triggers) while in evaluation process, nothing happens at 
> that time, but when evaluation finishes, cursor is passed few controls since qt 
> now sends all return keys pressed while 1st QLineEdit evaluated.
> 
> I've tried to delete all key events after evaluation finishes, but doesn't help.
> 
> Anyone  ?
> 
> Thanks.
> 
> zeljko
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest

Regards, John Weeks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111027/45b15517/attachment.html 


More information about the Qt-interest-old mailing list