summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2019-01-03 13:43:43 +0100
committerOliver Wolff <oliver.wolff@qt.io>2019-01-24 06:08:02 +0000
commitc4aaa11d86d419d1aa216beaaf7424c713b78c8e (patch)
treeb805109e552115401ebaa950b1006ff267b0ffa9
parentb17c07dc0b947c979372fbaf558ce9acc07d1837 (diff)
downloadqtlocation-c4aaa11d86d419d1aa216beaaf7424c713b78c8e.tar.gz
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>
-rw-r--r--tests/applications/positioning_backend/widget.cpp13
-rw-r--r--tests/applications/positioning_backend/widget.h1
-rw-r--r--tests/applications/positioning_backend/widget.ui23
3 files changed, 28 insertions, 9 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"));
+}
diff --git a/tests/applications/positioning_backend/widget.h b/tests/applications/positioning_backend/widget.h
index b67e53b8..e0dc68fc 100644
--- a/tests/applications/positioning_backend/widget.h
+++ b/tests/applications/positioning_backend/widget.h
@@ -59,6 +59,7 @@ private slots:
void on_radioButton_4_clicked();
void on_buttonUpdateSupported_clicked();
+ void on_buttonResetError_clicked();
private:
LogWidget *log = nullptr;
diff --git a/tests/applications/positioning_backend/widget.ui b/tests/applications/positioning_backend/widget.ui
index a96a83f6..9cb1566d 100644
--- a/tests/applications/positioning_backend/widget.ui
+++ b/tests/applications/positioning_backend/widget.ui
@@ -135,11 +135,22 @@
</widget>
</item>
<item row="11" column="1">
- <widget class="QLabel" name="labelErrorState">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="labelErrorState">
+ <property name="text">
+ <string>N/A</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonResetError">
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item row="10" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
@@ -199,7 +210,7 @@
<rect>
<x>43</x>
<y>21</y>
- <width>251</width>
+ <width>254</width>
<height>71</height>
</rect>
</property>