[vtkusers] Subclassing vtkInteractorStyleUser and Qt
Florian Schmidt
mista.tapas at gmx.net
Thu Dec 5 07:30:52 EST 2002
Hi..
I use a VtkQt library to put vtk-render windows into qt-qidgets. Now i
have a class which subclasses both QMainWindow and
vtkInteractorStyleUser to be able to catch mouse events in the
associated vtkrenderwindow. The Class gets instantiated via a new-call
(not using New()). This works like a charm. Mouse clicks get caught, i
can then use these to triger qt-signals..
Now, the vtk-method for creating objects is via the New() - method and
deleting via Delete(). Now, when the MainWindow gets destroyed, the
normal destructor gets called (i left these public for it to work). Of
course, then the reference counting mechanism gets confused (I see this,
cause i get generic warnings in the terminal).
What i do now, is to just call SetReferenceCount(0) in the Destructor.
This is a dirty hack i suppose (though it works liek a charm), and i ask
myself if there is no better way of doing this?
I also tried creating another class which inherits from
vtkInteractorStyleUser and QObject, and then use one object of this
class from within the mainwindow with SetInteractorStyle. But qt was
complaining about constructor not being public, etc..
Any help?
--
mista.tapas at gmx.net
http://mistatapas.ath.cx
http://www.arted.biz/mista.tapas
More information about the vtkusers
mailing list