[vtkusers] Re: vtkusers Digest, Vol 22, Issue 9

Clinton Stimpson clinton at elemtech.com
Thu Feb 9 13:31:05 EST 2006


> Date: Thu, 9 Feb 2006 22:53:05 +0800 (CST)
> From: Patrik Spring <patrikspring at yahoo.com.cn>
> Subject: [vtkusers] how implentment drag and drop operation from
>	QWidget to	QVTKWidget???
>To: vtkusers at vtk.org
>
> Who can give me a c++ example to implentment that QVTKWidget get a dragEnterEvent or dropEvent come from QT?
>  In QVTKWidget.cxx, I see dropEvent() and dragEnterEvent() ,  but I try my best can not implentment this operation!!
>  Must I reimplentment these method???? 
>   Thank advanced!

I don't have an example I can give you, but...

I can think of 3 different ways you can do it.

1.  reimplement those methods
2.  use an event filter
3.  QVTKWidget's implementation of dropEvent() and dragEnterEvent() will forward those events to the interactor style.
    You can make your own ProcessEvents() function for your subclass of an interactor style.  Set that ProcessEvents as your callback.  And call AddObserver on the interactor to get those events.  The advantage here is that you can keep all your event handling in one place, instead of two places which method 1, 2 would do.

Clint





More information about the vtkusers mailing list