| 24 | } |
| 25 | |
| 26 | void ProgressWidget::start(std::shared_ptr<Task> task) |
| 27 | { |
| 28 | if (m_task) |
| 29 | { |
| 30 | disconnect(m_task.get(), 0, this, 0); |
| 31 | } |
| 32 | m_task = task; |
| 33 | connect(m_task.get(), &Task::finished, this, &ProgressWidget::handleTaskFinish); |
| 34 | connect(m_task.get(), &Task::status, this, &ProgressWidget::handleTaskStatus); |
| 35 | connect(m_task.get(), &Task::progress, this, &ProgressWidget::handleTaskProgress); |
| 36 | connect(m_task.get(), &Task::destroyed, this, &ProgressWidget::taskDestroyed); |
| 37 | if (!m_task->isRunning()) |
| 38 | { |
| 39 | QMetaObject::invokeMethod(m_task.get(), "start", Qt::QueuedConnection); |
| 40 | } |
| 41 | } |
| 42 | bool ProgressWidget::exec(std::shared_ptr<Task> task) |
| 43 | { |
| 44 | QEventLoop loop; |
no test coverage detected