发送 信号 停止 timer 提示
QObject::killTimer: Timers cannot be stopped from another thread
QObject::~QObject: Timers cannot be stopped from another thread
启动时提示
QEventLoop: Cannot be used without QApplication
调试状态没有问题
发送信号量启动也没有问题
搞了半天查案看是
m_timer.moveToThread( &m_thread ); this->moveToThread( &m_thread );
尝试注释掉m_timer.moveToThread( &m_thread );或者this->moveToThread( &m_thread );
结果提示QObject::startTimer: Timers cannot be started from another thread
理论上注释掉m_timer.moveToThread( &m_thread ); timer还是在线程中运行的
后改位
this->moveToThread( &m_thread );//这个必须放到操作m_timer之前
connect(&m_timer, &QTimer::timeout, this, &InquiryProcess::OnTimeout ); m_timer.setSingleShot( true );
m_timer.moveToThread( &m_thread );
暂时解决
继续测试发现 有时还不能停止 停止槽函数不能进去
后改为直接使用线程 感觉时QTimer的bug