1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-29 05:22:25 -04:00

ValueDialZ: use sign wheel to reverse sign using keys

This commit is contained in:
f4exb 2017-05-17 22:32:03 +02:00
parent a0a8548c7b
commit 58fb967ca7

View File

@ -474,7 +474,7 @@ void ValueDialZ::keyPressEvent(QKeyEvent* value)
m_cursor--;
}
if (m_cursor < (m_positiveOnly ? 0 : 1)) {
if (m_cursor < 0) {
m_cursor++;
}
@ -503,6 +503,16 @@ void ValueDialZ::keyPressEvent(QKeyEvent* value)
}
}
else if(value->key() == Qt::Key_Up)
{
if (!m_positiveOnly && (m_cursor == 0))
{
if(m_animationState != 0) {
m_value = m_valueNew;
}
m_valueNew = (-m_value < m_valueMin) ? m_valueMin : (-m_value > m_valueMax) ? m_valueMax : -m_value;
}
else
{
qint64 e = findExponent(m_cursor);
@ -515,11 +525,22 @@ void ValueDialZ::keyPressEvent(QKeyEvent* value)
}
m_valueNew = m_value + e > m_valueMax ? m_valueMax : m_value + e;
}
setValue(m_valueNew);
emit changed(m_valueNew);
}
else if(value->key() == Qt::Key_Down)
{
if (!m_positiveOnly && (m_cursor == 0))
{
if(m_animationState != 0) {
m_value = m_valueNew;
}
m_valueNew = (-m_value < m_valueMin) ? m_valueMin : (-m_value > m_valueMax) ? m_valueMax : -m_value;
}
else
{
qint64 e = findExponent(m_cursor);
@ -532,6 +553,7 @@ void ValueDialZ::keyPressEvent(QKeyEvent* value)
}
m_valueNew = m_value - e < m_valueMin ? m_valueMin : m_value - e;
}
setValue(m_valueNew);
emit changed(m_valueNew);