--User changes

-Make a space bar press be the equivalent of a double click when inside of a spin box. This makes it easy to toggle without using the mouse.
This commit is contained in:
Person 2020-12-29 23:33:44 -08:00
parent 47b6614c8a
commit 8c591d6163
2 changed files with 20 additions and 0 deletions

View File

@ -310,6 +310,13 @@ void DoubleSpinBox::keyPressEvent(QKeyEvent* ke)
ke->accept();
}
else if (ke->key() == Qt::Key_Space)
{
if (IsClose(m_DoubleClickLowVal, value()))
setValue(m_DoubleClickZero);
else
setValue(m_DoubleClickNonZero);
}
else
QDoubleSpinBox::keyPressEvent(ke);
}

View File

@ -306,6 +306,19 @@ void SpinBox::keyPressEvent(QKeyEvent* ke)
ke->accept();
}
else if (ke->key() == Qt::Key_Space)
{
if (m_DoubleClickLowVal == value())
{
m_DoubleClickZeroEvent(this, m_DoubleClickZero);
setValue(m_DoubleClickZero);
}
else
{
m_DoubleClickNonZeroEvent(this, m_DoubleClickNonZero);
setValue(m_DoubleClickNonZero);
}
}
else
QSpinBox::keyPressEvent(ke);
}