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

List:       kde-devel
Subject:    Re: question about QMouseEvents
From:       Christian Loose <christian.loose () hamburg ! de>
Date:       2003-08-29 22:47:52
[Download RAW message or body]

Am Samstag, 30. August 2003 00:16 schrieb Jason Harris:
> Hello,
>
> I need to check if the user has pressed the left mouse button while holding
> down the CTRL key.
>
> This doesn't work:
>   if ( e->state() & ( ControlButton & LeftButton ) )
>
> Nor this:
>   if ( (e->state() & ControlButton) && (e->state() & LeftButton ) )
>
> But this does:
>   if ( (e->state() & ControlButton) && (e->button() == LeftButton ) )
>
> Can someone tell me why the first two forms do not work (i.e., the
> condition is not true if LMB pressed while CTRL pressed)?
>
> Just curious, so don't spend time looking it up on my behalf...just asking
> in case anyone happens to know offhand.
>
> thanks!
> Jason

My qt docs say:

Note that this means that for QEvent::MouseButtonPress and 
QEvent::MouseButtonDblClick, the flag for the button() itself will not be set 
in the state, whereas for QEvent::MouseButtonRelease it will. 

Christian
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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