Is it possible to run several QWidgets in separate threads
I am learning Qt and trying to create application that open 开发者_运维知识库documents in tabs of QTabWidget. And I need to have each tab running in separate thread. Is it possible? And if it is, can you please show a simple example.
No, this is not possible. Widgets needs to be always drawn and handled by the main thread, where the event loop is executed.
What you can do is defining some slots for each tab which open a document and connect to to some signals in your threads. This way you can emit a signal if a document should be opened in a tab from a different thread and it will be opened and handled by the event loop thread.
精彩评论