1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

Merge pull request #1303 from srcejon/fix_value_dial_fast_typing

Value dial: Check for completed animation before using m_value
This commit is contained in:
Edouard Griffiths 2022-06-23 21:20:06 +02:00 committed by GitHub
commit f58e22e338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -553,14 +553,14 @@ void ValueDial::keyPressEvent(QKeyEvent *value)
if (c >= QChar('0') && (c <= QChar('9'))) 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) { if (m_animationState != 0) {
m_value = m_valueNew; 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 = m_value - v * e;
v += d * e; v += d * e;
setValue(v); setValue(v);

View File

@ -619,16 +619,16 @@ void ValueDialZ::keyPressEvent(QKeyEvent* value)
} }
else if ((c >= QChar('0')) && (c <= QChar('9')) && (m_cursor > 0)) // digits 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'; int d = c.toLatin1() - '0';
quint64 e = findExponent(m_cursor); quint64 e = findExponent(m_cursor);
quint64 value = abs(m_value); quint64 value = abs(m_value);
int sign = m_value < 0 ? -1 : 1; int sign = m_value < 0 ? -1 : 1;
quint64 v = (value / e) % 10; quint64 v = (value / e) % 10;
if(m_animationState != 0) {
m_value = m_valueNew;
}
v = value - v * e; v = value - v * e;
v += d * e; v += d * e;
setValue(sign*v); setValue(sign*v);