WaitForStopDialog: Avoid using sender()

Change-Id: I559d8da00977f776c9d56cb63ea9ee6e72625de0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2022-07-20 17:47:10 +02:00
parent d96bfdff84
commit a6d28c9205
2 changed files with 4 additions and 6 deletions

View File

@@ -54,7 +54,7 @@ WaitForStopDialog::WaitForStopDialog(const QList<ProjectExplorer::RunControl *>
updateProgressText();
for (const RunControl *rc : runControls)
connect(rc, &RunControl::stopped, this, &WaitForStopDialog::runControlFinished);
connect(rc, &RunControl::stopped, this, [this, rc] { runControlFinished(rc); });
m_timer.start();
}
@@ -72,11 +72,9 @@ void WaitForStopDialog::updateProgressText()
m_progressLabel->setText(text);
}
void WaitForStopDialog::runControlFinished()
void WaitForStopDialog::runControlFinished(const RunControl *runControl)
{
auto rc = qobject_cast<RunControl *>(sender());
m_runControls.removeOne(rc);
m_runControls.removeOne(runControl);
if (m_runControls.isEmpty()) {
if (m_timer.elapsed() < 1000)
QTimer::singleShot(1000 - m_timer.elapsed(), this, &QDialog::close);