[pyQt_Error]QObject::killTimer: timers cannot be stopped from another thread
来源:互联网 发布:重庆开票软件金税盘版 编辑:程序博客网 时间:2024/05/21 17:56
QObject::killTimer: timers cannot be stopped from another thread
出现这个错误的原因在于在次线程中执行主线程对象的一些操作引起的
可以这样修改
如果次线程需要更新主线程对象状态,需要发送消息,主线程对象接收后处理而不能在此线程中直接操作
QT定时器非常好,只要注意跨线程问题
使用定时器的注意事项:
1. QT定时器线程相关的使用注意事项:
1> 不能夸线程启动定时器和停止定时器
1> 不能夸线程启动一个定时器关联的对象,但在另一个线程释放(析构)此和定时器关联的对象(相当于1>的情况不能在其他线程停止定时器).
qWarning(“QObject::killTimers:timers cannot be stopped from another thread”);
也就是定时器相关的逻辑和对象只能用在一个线程中.
因为QT的定时器有内部的数据结构来关联定时器相关逻辑.
否则:启动定时器的线程不能删除定时器,而定时器关联的对象已经不存在,那么下次定时器事件来时会崩溃.
详细原理可见
QThread 与 QObject的关系
0 0
- [pyQt_Error]QObject::killTimer: timers cannot be stopped from another thread
- 一个疑惑的问题:QObject::killTimer: Timers cannot be stopped from another thread
- ORB-SLAM2:QObject::~QObject: Timers cannot be stopped from another thread
- QT中解决QSocketNotifier: socket notifiers cannot be enabled from another thread错误
- QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
- QObject 之 Thread Affinity
- QObject 之 Thread Affinity
- QObject 之 Thread Affinity
- Server Timers, Windows Timers, and Thread Timers的对比
- The differen between Server Timers, Windows Timers, and Thread Timers
- How can I invoke functions on QObjects from another thread?
- Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible...
- QObject: Cannot create children for a parent that is in a different thread
- qt#5 QObject: Cannot create children for a parent that is in a different thread.
- QObject: Cannot create children for a parent that is in a different thread.
- QObject: Cannot create children for a parent that is in a different thread错误
- QObject: Cannot create children for a parent that is in a different thread.
- python报错——HealthGateway cannot be converted to PyQt5.QtCore.QObject in this context
- EDIT操作
- hdu5497 Inversion 树状数组 待补完!!!
- 梯度下降法详解
- 自定义控件三部曲之动画篇(一)——alpha、scale、translate、rotate、set的xml属性及用法
- <c:catch>标签的使用
- [pyQt_Error]QObject::killTimer: timers cannot be stopped from another thread
- 洛谷P1162 填涂颜色
- 485. Max Consecutive Ones
- DQL、DML、DDL、DCL的概念与区别
- 欢迎使用CSDN-markdown编辑器
- MFC关于对话框的问题
- 2016年个人经历流水总结-下半年
- 金蝶KIS商贸版V6.1销售类单据开发实现'联系人'模糊查询
- JS 按按钮数字增加一