1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05: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++;
}
@ -504,35 +504,57 @@ void ValueDialZ::keyPressEvent(QKeyEvent* value)
}
else if(value->key() == Qt::Key_Up)
{
qint64 e = findExponent(m_cursor);
if (!m_positiveOnly && (m_cursor == 0))
{
if(m_animationState != 0) {
m_value = m_valueNew;
}
if(value->modifiers() & Qt::ShiftModifier) {
e *= 5;
m_valueNew = (-m_value < m_valueMin) ? m_valueMin : (-m_value > m_valueMax) ? m_valueMax : -m_value;
}
else
{
qint64 e = findExponent(m_cursor);
if(m_animationState != 0) {
m_value = m_valueNew;
if(value->modifiers() & Qt::ShiftModifier) {
e *= 5;
}
if(m_animationState != 0) {
m_value = m_valueNew;
}
m_valueNew = m_value + e > m_valueMax ? m_valueMax : m_value + e;
}
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)
{
qint64 e = findExponent(m_cursor);
if (!m_positiveOnly && (m_cursor == 0))
{
if(m_animationState != 0) {
m_value = m_valueNew;
}
if(value->modifiers() & Qt::ShiftModifier) {
e *= 5;
m_valueNew = (-m_value < m_valueMin) ? m_valueMin : (-m_value > m_valueMax) ? m_valueMax : -m_value;
}
else
{
qint64 e = findExponent(m_cursor);
if(m_animationState != 0) {
m_value = m_valueNew;
if(value->modifiers() & Qt::ShiftModifier) {
e *= 5;
}
if(m_animationState != 0) {
m_value = m_valueNew;
}
m_valueNew = m_value - e < m_valueMin ? m_valueMin : m_value - e;
}
m_valueNew = m_value - e < m_valueMin ? m_valueMin : m_value - e;
setValue(m_valueNew);
emit changed(m_valueNew);
}