Using QWidget::update() from non-GUI thread

后端 未结 4 571
野的像风
野的像风 2020-12-10 18:32

Sometimes my application crashes in QWidget::update() that is performing in non-GUI thread.

I am developing an application in which receives video frames from remote

4条回答
  •  抹茶落季
    2020-12-10 19:23

    Check out the Mandelbrot Example. In that example a worker thread is generating an image and passing it to rendering widget with signal/slot mechanism. Use the same method!

    Instead of implementing a new updatePixmap() slot as given in the example you can directly connect update () slot of your widget as well.

    From your code I can see that you have a mutex to provide concurrent access. So it should be easy to directly use your update slot.

    Both methods still use signal/slot mechanism because GUI operations outside the main thread are not allowed in Qt.

提交回复
热议问题