开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜