1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

ConfigInputWidget: fix getting enum options from UAVO field

Should not use known field order to get UAVO field. This breaks
a widget after adding any float field to the object since after
sorting this field will have index 0 and shift other fields.

This fix should have some runtime checks to make sure the field
was really found, but it should be fixed through the whole GCS
code in a separate cleanup.
This commit is contained in:
Oleg Semyonov 2012-01-14 21:23:26 +02:00
parent 3b9e550a07
commit 13cee28ead

View File

@ -57,7 +57,7 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
setupButtons(m_config->saveRCInputToRAM,m_config->saveRCInputToSD);
unsigned int index=0;
foreach(QString name,manualSettingsObj->getFields().at(0)->getElementNames())
foreach (QString name, manualSettingsObj->getField("ChannelNumber")->getElementNames())
{
Q_ASSERT(index < ManualControlSettings::CHANNELGROUPS_NUMELEM);
inputChannelForm * inp=new inputChannelForm(this,index==0);
@ -1096,7 +1096,7 @@ void ConfigInputWidget::invertControls()
QCheckBox * cb=qobject_cast<QCheckBox *>(wd);
if(cb)
{
int index=manualSettingsObj->getFields().at(0)->getElementNames().indexOf(cb->text());
int index = manualSettingsObj->getField("ChannelNumber")->getElementNames().indexOf(cb->text());
if((cb->isChecked() && (manualSettingsData.ChannelMax[index]>manualSettingsData.ChannelMin[index])) ||
(!cb->isChecked() && (manualSettingsData.ChannelMax[index]<manualSettingsData.ChannelMin[index])))
{