I receive a signal from a worker thread and re-emit it via C++ Singleton (CTaskManager) to qml.
void CTaskManager::runAsync(CTask* task)
{
Q_CHECK_PTR(task);
QThread* thread = new QThread();
task->moveToThread(thread);
connect(this , SIGNAL(canceled()) , task , SLOT(cancel()) , Qt::DirectConnection);
connect(task , SIGNAL(progressChanged(float)) , this , SLOT(setProgress(float)) , Qt::DirectConnection);
connect(task , SIGNAL(finished(bool,unsigned int, const QVariantMap&)) , this , SLOT(setFinished(bool,unsigned int, const QVariantMap&)) , Qt::DirectConnection);
connect(thread , SIGNAL(started()) , task , SLOT(run()));
connect(task , SIGNAL(finished(bool,unsigned int, const QVariantMap&)) , thread, SLOT(quit()));
connect(thread , SIGNAL(finished()) , task , SLOT(deleteLater()));
connect(thread , SIGNAL(finished()) , thread, SLOT(deleteLater()));
thread->start();
}
void CTaskManager::setFinished(bool canceled, unsigned int error, const QVariantMap& args)
{
emit this->finished(canceled, error, args);
}
This works fine with Qt Creator 4.6.1 under LINUX. When i run the same Project under Windows i get only undefined parameters in my qml signal connection.
Connections
{
target: TaskManager
onFinished:
{
}
}
Any ideas ?