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

View File

@@ -47,7 +47,7 @@ public:
bool canceled(); bool canceled();
private: private:
void updateProgressText(); void updateProgressText();
void runControlFinished(); void runControlFinished(const RunControl *runControl);
QList<ProjectExplorer::RunControl *> m_runControls; QList<ProjectExplorer::RunControl *> m_runControls;
QLabel *m_progressLabel; QLabel *m_progressLabel;