forked from qt-creator/qt-creator
WaitForStopDialog: Avoid using sender()
Change-Id: I559d8da00977f776c9d56cb63ea9ee6e72625de0 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user