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

List:       kde-devel
Subject:    Re: question about QMouseEvents
From:       Kevin Krammer <kevin.krammer () gmx ! at>
Date:       2003-08-29 22:54:27
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Saturday 30 August 2003 00:16, Jason Harris wrote:
> 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.

state() is which buttons where pressed when the event happened, button() 
is which button triggered the event.
The other checks will work in move events, where the event is not 
triggered by a button

hope that made sense.

Cheers,
Kevin

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Krammer <kevin.krammer@gmx.at>
Developer at the Kmud Project http://www.kmud.de/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[Attachment #5 (application/pgp-signature)]

>> 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