QPixmap: It is not safe to use pixmaps outside the GUI thread
2014-04-02 16:45
357 查看
今天遇到这个问题
程序是次线程处理完数据后,发射一个信号给主线程,显示更新图片,然后提示QPixmap: It is not safe to use pixmaps outside the GUI thread
提示这个错误的时候两个线程之间的信号槽连接属性是Qt::DirectConnection,会提示不是在GUI线程里
后面属性改为默认的,不写,就不会出现这个问题了。
关键还是看连接属性的具体说明:
Qt::AutoConnection
0 (default) If the signal is emitted from a different thread than the receiving object, the signal is queued,
behaving as Qt::QueuedConnection. Otherwise, the slot is invoked directly, behaving as Qt::DirectConnection. The type of connection is determined when the signal is emitted.
Qt::DirectConnection 1
The slot is invoked immediately, when the signal is emitted.
Qt::QueuedConnection 2
The slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread.
程序是次线程处理完数据后,发射一个信号给主线程,显示更新图片,然后提示QPixmap: It is not safe to use pixmaps outside the GUI thread
提示这个错误的时候两个线程之间的信号槽连接属性是Qt::DirectConnection,会提示不是在GUI线程里
后面属性改为默认的,不写,就不会出现这个问题了。
关键还是看连接属性的具体说明:
Qt::AutoConnection
0 (default) If the signal is emitted from a different thread than the receiving object, the signal is queued,
behaving as Qt::QueuedConnection. Otherwise, the slot is invoked directly, behaving as Qt::DirectConnection. The type of connection is determined when the signal is emitted.
Qt::DirectConnection 1
The slot is invoked immediately, when the signal is emitted.
Qt::QueuedConnection 2
The slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread.
相关文章推荐
- QPixmap: It is not safe to use pixmaps outside the GUI thread原因
- QT QPixmap:It is not safe to use Pixmaps outside the GUI thread
- Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use
- Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use
- Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use
- PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings
- It is not safe to rely on the system's timezone settings
- home 解决php的“It is not safe to rely on the system’s timezone settings”问题
- php Warning: date(): It is not safe to rely on the system's timezone settings.
- 解决php的It is not safe to rely on the system’s timezone settings的问题
- It is not safe to rely on the system's timezone settings. You are *required*
- PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings.处理方法
- 解决php的It is not safe to rely on the system’s timezone settings的问题
- php5.3的It is not safe to rely on the system’s timezone settings的问题的解决方案
- 解决php的It is not safe to rely on the system’s timezone settings的问题
- arning: date(): It is not safe to rely on the......错误的解决办法
- PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone
- PHP Warning: strftime(): It is not safe to rely on the system's timezone testlink
- 解决PHP date调用警告:It is not safe to rely on the system's timezone settings 转载
- It is not safe to rely on the system's timezone settings错误