[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Key Pressed or Released in keyPressEvent ?
From:       Carsten Pfeiffer <carpdjih () cetus ! zrz ! TU-Berlin ! DE>
Date:       1999-08-28 20:55:39
[Download RAW message or body]

On Sat, Aug 28, 1999 at 11:19:32PM +0200, Markus Goetz wrote:

Hi,
 
> void KKeyWordComboBox::keyPressEvent ( QKeyEvent * e )
> {
>  QComboBox::keyPressEvent (e);
>  if (e->key() == Key_Return)
>   {
>    emit pressedReturn();
>   }
> }
> 
> The problem is : If the user presses RETURN once but the event is raised twice
> (i think once for pressed and once for released).

no, the method is called keyPressEvent() - release-events are handled in
(guess what) keyReleaseEvent(). Dunno what causes the double event. What
happens if you add e->accept() ?

PS: you might consider checking for Key_Enter, too.

Cheers,
Carsten Pfeiffer
-- 
http://www.geocities.com/SiliconValley/1632/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic