QT QPixmap:It is not safe to use Pixmaps outside the GUI thread

来源:互联网 发布:懒人js代码 编辑:程序博客网 时间:2024/05/29 16:43

写了一个程序,用了python的threading模块新建了一个线程来做了一些显示调用。运行的时候报下面的错误:

QT QPixmap:It is not safe to use Pixmaps outside the GUI thread

百度了一下
Qt只允许主线程(也就是main函数在的那个线程)使用界面类,因为界面类不是线程安全的,不可重入,在多个线程中使用可能会出现问题,因此Qt不建议主界面线程外的线程使用图形类和调用图形类接口。否则有可能报错:<span style="font-family: 'Microsoft YaHei', SimHei, arial, 宋体; font-size: 15px;"><span style="color: rgb(255, 0, 0);">QT QPixmap:It is not safe to use Pixmaps outside the GUI thread</span> </span>

0 0
原创粉丝点击