From 33c19b6fe0b0e9a687d9add3622e1bdd9eef5ef1 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 23 Jun 2022 16:26:27 +0100 Subject: [PATCH] Value dial: Check for completed animation before using m_value --- sdrgui/gui/valuedial.cpp | 8 ++++---- sdrgui/gui/valuedialz.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdrgui/gui/valuedial.cpp b/sdrgui/gui/valuedial.cpp index 3af067f13..8f4a9f901 100644 --- a/sdrgui/gui/valuedial.cpp +++ b/sdrgui/gui/valuedial.cpp @@ -553,14 +553,14 @@ void ValueDial::keyPressEvent(QKeyEvent *value) if (c >= QChar('0') && (c <= QChar('9'))) { - int d = c.toLatin1() - '0'; - quint64 e = findExponent(m_cursor); - quint64 v = (m_value / e) % 10; - if (m_animationState != 0) { m_value = m_valueNew; } + int d = c.toLatin1() - '0'; + quint64 e = findExponent(m_cursor); + quint64 v = (m_value / e) % 10; + v = m_value - v * e; v += d * e; setValue(v); diff --git a/sdrgui/gui/valuedialz.cpp b/sdrgui/gui/valuedialz.cpp index 32c3fa91e..c3e77df11 100644 --- a/sdrgui/gui/valuedialz.cpp +++ b/sdrgui/gui/valuedialz.cpp @@ -619,16 +619,16 @@ void ValueDialZ::keyPressEvent(QKeyEvent* value) } else if ((c >= QChar('0')) && (c <= QChar('9')) && (m_cursor > 0)) // digits { + if(m_animationState != 0) { + m_value = m_valueNew; + } + int d = c.toLatin1() - '0'; quint64 e = findExponent(m_cursor); quint64 value = abs(m_value); int sign = m_value < 0 ? -1 : 1; quint64 v = (value / e) % 10; - if(m_animationState != 0) { - m_value = m_valueNew; - } - v = value - v * e; v += d * e; setValue(sign*v);