[Simulator] Make 2-way switches return -1 || 1 instead of 0 || 1. Fixes https://github.com/opentx/opentx/issues/4343 .
This commit is contained in:
@@ -61,6 +61,7 @@ class RadioSwitchWidget : public RadioWidget
|
||||
m_slider->setMinimum((swType == Board::SWITCH_3POS ? -1 : 0));
|
||||
m_slider->setMaximum(1);
|
||||
m_slider->setTickInterval(1);
|
||||
m_slider->setSingleStep(1);
|
||||
m_slider->setValue(m_value);
|
||||
|
||||
if (swType == Board::SWITCH_TOGGLE) {
|
||||
@@ -102,6 +103,12 @@ class RadioSwitchWidget : public RadioWidget
|
||||
|
||||
}
|
||||
|
||||
int getValue() const
|
||||
{
|
||||
int val = m_slider->value() - (swType == Board::SWITCH_3POS || m_slider->value() == 1 ? 0 : 1);
|
||||
return val;
|
||||
}
|
||||
|
||||
void setToggleLocked(bool lock)
|
||||
{
|
||||
if (m_flags != (quint16)lock) {
|
||||
|
||||
@@ -77,7 +77,7 @@ class RadioWidget : public QWidget
|
||||
void changeVisibility(bool visible);
|
||||
|
||||
|
||||
int getValue() const;
|
||||
virtual int getValue() const;
|
||||
int getIndex() const;
|
||||
int getType() const;
|
||||
QByteArray getStateData() const;
|
||||
|
||||
Reference in New Issue
Block a user