[vtkusers] Combining event loops from Qt Application and VTK Interactors
Tom Radcliffe
radtea at yahoo.co.uk
Tue Jun 27 01:11:59 EDT 2000
--- Marcel van Straten <streets at mediaport.org> wrote:
> >
> I want to combine Trolltech Qt and VTK. Before
> trying to use a
> vtkRenderWindow as a QWidget, I would like to have
> separate windows (one for
> VTK / OpenGL rendering and one for Qt GUI).
>
> In order to process events generated in both
> windows, I have to combine the
> event loops (I suppose). Does anyone have
> experiences with doing this?
>
Combing event loops is difficult -- it's probably
simpler to deal with this by integrating Qt and VTK by
getting the native window handle from the QWidget
(using getWindowID, I think) and passing it to the
vtkRenderWindow (using SetWindowHandle, I think). I'm
not sending from work and so don't have the exact code
in front of me, but this is an easy way of integrating
the two frameworks. All event processing is done by
Qt, and events are passed by Qt handlers down to the
VTK layer.
The actual connection between the windows can be done
in the polish() method of QWidget class you derive to
hold the vtkRenderWindow, something like:
class VTKWidget
{
public:
VTKWidget() :
m_RenderWindow(VTKRenderWindow::New()) {;}
void polish()
{
m_RenderWindow->SetWindowHandle(getWindowID());
}
void paint()
{
m_RenderWindow->Render();
}
// other qevent handlers...
private:
vtkRenderWindow* m_RenderWindow;
};
That's just a cartoon, not a real implementation, but
should still get the ideas across.
--Tom
Tom Radcliffe
Senior Software Designer
iGO Technologies Inc.
radcliffe at igotechnologies.com
____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie
More information about the vtkusers
mailing list