mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Issue #77 Refactor to inline functions
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user