[Qt-interest] Problem with enter pressed event

Duane duane.hebert at group-upc.com
Mon Mar 28 14:18:23 CEST 2011


On 3/26/2011 12:25 AM, Alex Strickland wrote:
> On 2011/03/25 09:19 PM, Duane wrote:
>
>> But shouldn't the line edit
>> gobble the enter pressed event when focus is on the line edit?
>>
>> Any suggestions?
>
> Not specifically, but remember that by default tab is the key that
> shifts focus. Perhaps there is a setting for the dialog to change that?
>

This seems sort of counter intuitive.  My problem is that the line edit 
has focus as the user is typing in it.  And when enter is pressed, the 
line edit's enter event is fired.  But my problem seems to be that the 
dialog's enter event is also fired causing whatever happens to have 
focus at the time to trigger its enter pressed event as well.

This seems like a bug to me.  If I press one of the pushbuttons, their 
click() event is fired but nothing else gets an enter event.  I would 
expect the line edit to work the same way.

It seems that to make this work as I would like, I would have to use an 
event filter and if it's the line edit somehow gobble the event myself.
But then this would depend on the event queue having the line edit first.






More information about the Qt-interest-old mailing list