diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2019-01-03 13:43:43 +0100 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2019-01-24 06:08:02 +0000 |
commit | c4aaa11d86d419d1aa216beaaf7424c713b78c8e (patch) | |
tree | b805109e552115401ebaa950b1006ff267b0ffa9 /tests/applications/positioning_backend/widget.cpp | |
parent | b17c07dc0b947c979372fbaf558ce9acc07d1837 (diff) |
test app: Improve status and error handling a bit
- Reset "running" check box if an error occurs
- Add check box to manually reset position source's error code, as error
is not emitted with NoError
- There is no need to handle the "OK" case in errorChanged, as the
corresponding signal will not be emitted for NoError
Change-Id: I53d637c8efd807d6c3e8abff98963585fe74f220
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests/applications/positioning_backend/widget.cpp')
-rw-r--r-- | tests/applications/positioning_backend/widget.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/applications/positioning_backend/widget.cpp b/tests/applications/positioning_backend/widget.cpp index efdaebdd..3244c478 100644 --- a/tests/applications/positioning_backend/widget.cpp +++ b/tests/applications/positioning_backend/widget.cpp @@ -102,7 +102,9 @@ void Widget::positionTimedOut() void Widget::errorChanged(QGeoPositionInfoSource::Error err) { - ui->labelErrorState->setText(err == 3 ? QStringLiteral("OK") : QString::number(err)); + ui->labelErrorState->setText(QString::number(err)); + m_posSource->stopUpdates(); + ui->checkBox->setChecked(false); } Widget::~Widget() @@ -126,11 +128,11 @@ void Widget::on_buttonStart_clicked() // Either start or stop the current position info source bool running = ui->checkBox->isChecked(); if (running) { - m_posSource->stopUpdates(); ui->checkBox->setChecked(false); + m_posSource->stopUpdates(); } else { - m_posSource->startUpdates(); ui->checkBox->setChecked(true); + m_posSource->startUpdates(); } } @@ -175,3 +177,8 @@ void Widget::on_buttonUpdateSupported_clicked() ui->labelSupported->setText(text); } + +void Widget::on_buttonResetError_clicked() +{ + ui->labelErrorState->setText(QStringLiteral("N/A")); +} |