1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-04 06:07:49 -04:00

ValueDialZ: use sign wheel to reverse sign

This commit is contained in:
f4exb 2017-05-17 22:24:58 +02:00
parent b0a765d67a
commit a0a8548c7b

View File

@ -358,10 +358,6 @@ void ValueDialZ::mouseMoveEvent(QMouseEvent* event)
{ {
i = -1; i = -1;
} }
else if ((m_text[i] == QChar('+')) || (m_text[i] == QChar('-')))
{
i = -1;
}
if(i != m_hightlightedDigit) if(i != m_hightlightedDigit)
{ {
@ -376,9 +372,7 @@ void ValueDialZ::wheelEvent(QWheelEvent* event)
i = (event->x() - 1) / m_digitWidth; i = (event->x() - 1) / m_digitWidth;
if ((m_text[i] != QChar('.')) && if (m_text[i] != QChar('.'))
(m_text[i] != QChar('+')) &&
(m_text[i] != QChar('-')))
{ {
m_hightlightedDigit = i; m_hightlightedDigit = i;
} }
@ -394,25 +388,32 @@ void ValueDialZ::wheelEvent(QWheelEvent* event)
update(); update();
} }
qint64 e = findExponent(m_hightlightedDigit);
if(m_animationState == 0) if(m_animationState == 0)
{ {
if(event->delta() < 0) if (!m_positiveOnly && (m_hightlightedDigit == 0))
{ {
if(event->modifiers() & Qt::ShiftModifier) { m_valueNew = (-m_value < m_valueMin) ? m_valueMin : (-m_value > m_valueMax) ? m_valueMax : -m_value;
e *= 5;
}
m_valueNew = (m_value - e < m_valueMin) ? m_valueMin : m_value - e;
} }
else else
{ {
if(event->modifiers() & Qt::ShiftModifier) { qint64 e = findExponent(m_hightlightedDigit);
e *= 5;
}
m_valueNew = (m_value + e > m_valueMax) ? m_valueMax : m_value + e; if(event->delta() < 0)
{
if(event->modifiers() & Qt::ShiftModifier) {
e *= 5;
}
m_valueNew = (m_value - e < m_valueMin) ? m_valueMin : m_value - e;
}
else
{
if(event->modifiers() & Qt::ShiftModifier) {
e *= 5;
}
m_valueNew = (m_value + e > m_valueMax) ? m_valueMax : m_value + e;
}
} }
setValue(m_valueNew); setValue(m_valueNew);