PyQt - Modify GUI from another thread

前端 未结 1 615
忘了有多久
忘了有多久 2020-12-18 09:36

I\'m trying to modify my main layout from another thread. But the function run() is never called and i\'m having the error:

QObject::setParent: Cannot

相关标签:
1条回答
  • 2020-12-18 10:22

    In Qt you should never attempt to directly update the GUI from outside of the GUI thread.

    Instead, have your threads emit signals and connect them to slots which do the necessary updating from within the GUI thread.

    See the Qt documentation regarding Threads and QObjects.

    0 讨论(0)
提交回复
热议问题