[Qt-interest] QGraphicsWidget hover events

Oliver Demetz forenbeitraege at oliverdemetz.de
Fri Jun 12 11:31:52 CEST 2009


Ok, that's a good argument :-)

Then my next idea is to make sure that all other items in your scene do 
not make mistakes at handling mouse-events.
If you reimplement eg. a mouseMoveEvent and not call the parents event 
handler, the event is catched and dies.
(eg. if you specify your item as movable and some other item does not 
call QGraphicsItem::mouseMoveEvent(event), it might happen that your 
item is not movable.)
Perhaps that's the same problem in your case, just with hoverEvents.

Regards,
Oliver


Colin Kern schrieb:
> Because I have exit(0) in my hover events to test that they get called.
> 
> Colin
> 
> On Friday, June 12, 2009, Oliver Demetz <forenbeitraege at oliverdemetz.de> wrote:
>> How do you know that the event is never executed?
>> Hint:
>> If you just change the visual appearance of your item, be aware that a hover-enter or -leave events to not trigger a repaint! I had to call this->update() in order to "see" the hover effect!
>> Regards,
>> Oliver
>>
>> Colin Kern schrieb:
>>
>> Hi,
>>
>> I'm trying to implement the hoverEnterEvent for a QGraphicsWidget, and
>> I can't get it to work.  I call setAcceptHoverEvents(true) in the
>> constructor, but the hoverEnterEvent still is never called.  Looking
>> at event() in qgraphicswidget.cpp, it looks to me like if window
>> decorations aren't set, then the hover events are just ignored.  Also,
>> the hoverLeaveEvent and hoverMoveEvent are reimplemented in
>> qgraphicswidget.cpp, but not hoverEnterEvent.  I have tried
>> implementing hoverLeaveEvent and hoverMoveEvent to see if those events
>> are ever triggered, and they don't seem to be either.  How can I get
>> hover events working in a QGraphicsWidget?
>>
>> Thanks,
>> Colin
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>>




More information about the Qt-interest-old mailing list