diff --git a/ground/openpilotgcs/src/plugins/config/airframe_custom.ui b/ground/openpilotgcs/src/plugins/config/airframe_custom.ui index 189356db1..b9fe945fd 100644 --- a/ground/openpilotgcs/src/plugins/config/airframe_custom.ui +++ b/ground/openpilotgcs/src/plugins/config/airframe_custom.ui @@ -138,6 +138,12 @@ 12 + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::NoSelection + 50 diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp index 9821ed2c9..93a9e9da6 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp @@ -130,6 +130,7 @@ ConfigCustomWidget::ConfigCustomWidget(QWidget *parent) : VehicleConfig(parent), m_aircraft(new Ui_CustomConfigWidget()) { m_aircraft->setupUi(this); + m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::NoEditTriggers); // Put combo boxes in line one of the custom mixer table: UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); @@ -206,6 +207,18 @@ void ConfigCustomWidget::refreshWidgetsValues(QString frameType) setupUI(frameType); + UAVDataObject *system = dynamic_cast(getObjectManager()->getObject(QString("SystemSettings"))); + Q_ASSERT(system); + QPointer field = system->getField(QString("AirframeType")); + + // Do not allow table edit until AirframeType == Custom + // First save set AirframeType to 'Custom' and next modify. + if (field->getValue().toString() != "Custom") { + m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + } else { + m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::AllEditTriggers); + } + UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(mixer);