[vtkusers] vtk render window in a Qt4 Application + QThreads

Андрей Траченко goodrone at gmail.com
Fri Aug 27 06:42:22 EDT 2010


Hi Bill,

you should never directly call anything related to GUI from your
custom QThread's. In most cases you should communicate to the GUI
thread (main thread) using signals and slots and using
Qt::QueuedConnection or Qt::BlockingQueuedConnection as the connection
between them. It is also a good idea to copy data to (or update) the
vtkPolyData you are drawing in the GUI thread OR create a new
vtkPolyData and delete the old one — this way you don't need mutexes
(if you can afford holding two copied of your data in memory).

On Fri, Aug 27, 2010 at 14:27, Alex Southern <mrapsouthern at gmail.com> wrote:
> Hi Bill,
>
> Just to say I'm interested in doing something like this as well in the near
> future, I wait in eager anticipation for a nudge in the right direction....
>
> BR.
> Alex.
>
> On 27.8.2010 13:15, Bill Chivas wrote:
>
> Hi everyone,
>
> i have a Qt4 application and i use vtk to display a vtkpolydata.
> I start a new QThread in order to do some heavy computations and within the
> thread i call a method of mainWindow which updates the data and the vtk
> window.
> Of course it doesn't work because i access with no synchronization shared
> data. I think i should use mutexes but unfortunately iam not familiar.
> Can anyone help me in order to fix this problem?
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list