Issue #77 Refactor to inline functions

This commit is contained in:
Mat Sutcliffe
2020-08-24 00:50:28 +01:00
parent ac454ebf3a
commit 92edbb90c2
9 changed files with 73 additions and 85 deletions

View File

@@ -24,16 +24,6 @@ namespace BlackMisc
return QThread::currentThread() == toBeTested->thread();
}
bool CThreadUtils::isApplicationThreadObjectThread(const QObject *toBeTested)
{
return qApp && toBeTested->thread() == qApp->thread();
}
bool CThreadUtils::isApplicationThread(const QThread *toBeTested)
{
return qApp && toBeTested == qApp->thread();
}
bool CThreadUtils::isCurrentThreadApplicationThread()
{
return qApp && QThread::currentThread() == qApp->thread();
@@ -47,13 +37,4 @@ namespace BlackMisc
const QString id = QString::fromStdString(oss.str());
return QStringLiteral("%1 (%2) prio %3").arg(id).arg(thread->objectName()).arg(thread->priority());
}
bool CThreadUtils::callInObjectThread(QObject *object, std::function<void()> callFunct)
{
if (!object) { return false; }
if (CThreadUtils::isCurrentThreadObjectThread(object)) { return false; }
QMetaObject::invokeMethod(object, callFunct);
return true;
}
} // ns