mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
refs #388 Use slots to start & stop QTimers from another thread
This commit is contained in:
@@ -33,8 +33,7 @@ namespace BlackMisc
|
||||
void CThreadedReader::requestStop()
|
||||
{
|
||||
setFinished();
|
||||
QWriteLocker(&this->m_lock);
|
||||
this->m_updateTimer->stop();
|
||||
QMetaObject::invokeMethod(m_updateTimer, "stop");
|
||||
}
|
||||
|
||||
CThreadedReader::~CThreadedReader()
|
||||
@@ -50,14 +49,13 @@ namespace BlackMisc
|
||||
void CThreadedReader::setInterval(int updatePeriodMs)
|
||||
{
|
||||
Q_ASSERT(this->m_updateTimer);
|
||||
QWriteLocker(&this->m_lock);
|
||||
if (updatePeriodMs < 1)
|
||||
{
|
||||
this->m_updateTimer->stop();
|
||||
QMetaObject::invokeMethod(m_updateTimer, "stop");
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_updateTimer->start(updatePeriodMs);
|
||||
QMetaObject::invokeMethod(m_updateTimer, "start", Q_ARG(int, updatePeriodMs));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user