[Qt-interest] QgraphicsScene: best way to manage events

Mihail Naydenov mlists at ymail.com
Fri Nov 26 15:53:57 CET 2010


You impl dragMoveEvent, there you accept ;)




----- Original Message ----
> From: "Oliver.Knoll at comit.ch" <Oliver.Knoll at comit.ch>
> To: qt-interest at trolltech.com
> Sent: Fri, November 26, 2010 4:48:19 PM
> Subject: Re: [Qt-interest] QgraphicsScene: best way to manage events
> 
> On 2010-11-26 ITS-CMT-SUI-SL-SFR-FIN-DEV Knoll Oliver,  
>ITS-CMT-SUI-SL-SFR-FIN-DEV wrote:
> 
> >> ...
> >> The "most  specific" widget/item gets the mouse event first (especially
> >> when  talking about "mouse hover/move only" events), and only if that
> >>  widget/item is *not* interested in that event it gets dispatched up
> >>  the hierarchy, until the root element (the QGraphicsScene for example).
> > 
> > But those particular events don't bubble all the way up since they're  
>synthesized by
> > QGraphicsScene, so its not possible to intercept them at  the "global
> > QGraphicsScene" level, 
> 
> Okay, I think I start to  understand what you mean: the events in 
>QGraphicsScene are of type  QGraphicsSceneDragDropEvent instead of 
>QDropEvent/QDragEnterEvent etc., so they  are not propagated "outside the world 
>of QGraphicsScene".
> 
> As a matter of  fact I currently also struggle to get a simple drag and drop 
>implemented on my  QGraphicsScene. I call setAcceptDrops(true) on the 
>corresponding QGraphicsView,  and in my derived QGraphicsScene object the  
>dragEnterEvent(QGraphicsSceneDragDropEvent *event) method is called. Therein I  
>simply call event->acceptProposedAction() in case the event contains the  
>expected MIME type (and I see in the debugger that this code is indeed called) -  
>but my dropEvent(QGraphicsSceneDragDropEvent *event) is never called, and the  
>cursor doesn't even change shape to "drag'n'drop accepted"!
> 
> I don't want  to hijack this thread here, and I have to think about it a bit 
>more, so I'll  come up with concrete questions later on maybe...
> 
> Thanks,  Oliver
> --
> Oliver Knoll
> Dipl. Informatik-Ing. ETH
> COMIT AG - ++41 79  520 95  22
> 
> 
> 
> _______________________________________________
> 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