From c59c6f22b16eef8a537b85266defe17a7e73ee59 Mon Sep 17 00:00:00 2001 From: Rainer Kartmann <rainer.kartmann@kit.edu> Date: Tue, 14 Jun 2022 10:46:12 +0200 Subject: [PATCH] Tweak display of timestamp input --- .../armem_gui/prediction_widget/TimestampInput.cpp | 7 +++++-- .../libraries/armem_gui/prediction_widget/TimestampInput.h | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/RobotAPI/libraries/armem_gui/prediction_widget/TimestampInput.cpp b/source/RobotAPI/libraries/armem_gui/prediction_widget/TimestampInput.cpp index cb24c31d7..04b28cde4 100644 --- a/source/RobotAPI/libraries/armem_gui/prediction_widget/TimestampInput.cpp +++ b/source/RobotAPI/libraries/armem_gui/prediction_widget/TimestampInput.cpp @@ -40,11 +40,12 @@ namespace armarx::armem::gui // This cast is safe because 999 * 1000 < MAX_INT. microseconds->setValue( static_cast<int>((QDateTime::currentMSecsSinceEpoch() % 1000) * 1000)); + microseconds->setSuffix(" µs"); auto* hlayout = new QHBoxLayout(); hlayout->addWidget(new QLabel("Time")); hlayout->addWidget(dateTime); - hlayout->addWidget(new QLabel("µs")); + hlayout->addWidget(new QLabel(".")); hlayout->addWidget(microseconds); setLayout(hlayout); } @@ -58,8 +59,10 @@ namespace armarx::armem::gui RelativeTimestampInput::RelativeTimestampInput() : seconds(new QDoubleSpinBox()) { - seconds->setSingleStep(0.1); seconds->setDecimals(6); + seconds->setSingleStep(0.1); + seconds->setRange(-1e6, 1e6); + seconds->setSuffix(" s"); seconds->setValue(0); auto* hlayout = new QHBoxLayout(); diff --git a/source/RobotAPI/libraries/armem_gui/prediction_widget/TimestampInput.h b/source/RobotAPI/libraries/armem_gui/prediction_widget/TimestampInput.h index 511a2d415..59e5cfa20 100644 --- a/source/RobotAPI/libraries/armem_gui/prediction_widget/TimestampInput.h +++ b/source/RobotAPI/libraries/armem_gui/prediction_widget/TimestampInput.h @@ -35,6 +35,7 @@ namespace armarx::gui namespace armarx::armem::gui { + class TimestampInput : public QWidget { Q_OBJECT // NOLINT @@ -43,6 +44,7 @@ namespace armarx::armem::gui virtual armarx::DateTime retrieveTimeStamp() = 0; }; + class AbsoluteTimestampInput : public TimestampInput { Q_OBJECT // NOLINT @@ -57,6 +59,7 @@ namespace armarx::armem::gui armarx::gui::LeadingZeroSpinBox* microseconds; }; + class RelativeTimestampInput : public TimestampInput { Q_OBJECT // NOLINT @@ -69,4 +72,5 @@ namespace armarx::armem::gui private: QDoubleSpinBox* seconds; // NOLINT }; + } // namespace armarx::armem::gui -- GitLab