diff options
Diffstat (limited to 'src/speedcheck.cpp')
-rw-r--r-- | src/speedcheck.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/speedcheck.cpp b/src/speedcheck.cpp index aa02d47..428be75 100644 --- a/src/speedcheck.cpp +++ b/src/speedcheck.cpp @@ -10,7 +10,7 @@ #include <QDebug> #include <QTimer> -SpeedCheck::SpeedCheck(QString fileName) +SpeedCheck::SpeedCheck(QString fileName, bool autoStart) : _ui(new Ui::MainWindow), _thread(NULL), _doQuit(false), @@ -21,6 +21,12 @@ SpeedCheck::SpeedCheck(QString fileName) connect(_ui->btnQuit, SIGNAL(clicked(bool)), this, SLOT(quitClicked(bool))); _timer.setInterval(200); connect(&_timer, SIGNAL(timeout()), this, SLOT(updateTimer())); + if (autoStart) { + _doQuit = true; + QTimer::singleShot(1, [this]() { + this->startClicked(true); + }); + } } SpeedCheck::~SpeedCheck() @@ -70,6 +76,7 @@ void SpeedCheck::testFinished() _thread = NULL; if (_doQuit) { QCoreApplication::instance()->quit(); + return; } _ui->btnStart->setEnabled(true); } |