[Qt-interest] Use different cursor when different modifier key is pressed

Abhishek abhishekworld at gmail.com
Tue Nov 10 06:03:13 CET 2009


HI Stephen,

if you look at Doc
http://doc.trolltech.com/4.5/qgraphicsitem.html#keyPressEvent

it says *Note that key events are only received for items that set the
ItemIsFocusable<http://doc.trolltech.com/4.5/qgraphicsitem.html#GraphicsItemFlag-enum>flag,
and that have keyboard input focus.
*

this might help you.
--
Abhishek.

On Tue, Nov 10, 2009 at 1:55 AM, Stephen Chu <stephen at ju-ju.com> wrote:

> Hi
>
> I have a custom QGraphicsItem that needs to use different cursor when
> different modifier key is pressed. For example, changes to magnify glass
> when option/alt key is pressed.
>
> This tracking of modifiers states should only happen when the mouse is
> inside of the item. And it can not remove keyboard focus from other
> widgets in the same window.
>
> I added hoverEnterEvent(), hoverLeaveEvent(), and hoverMoveEvent() to my
> item and it does get those events after setAcceptHoverEvents(true). But
> it doesn't get called when the mouse is in the item and not moving but
> user presses or releases keys.
>
> keyPressEvent() and keyReleaseEvent() are never called even after
> calling grabKeyboard() in hoverEnterEvent().
>
> Any idea?
>
> Thanks.
>
> --
> Stephen Chu
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
Abhishek Patil

"Imagination is more important than knowledge..." -Albert Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091110/c185ee0f/attachment.html 


More information about the Qt-interest-old mailing list