1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

OP-1134 Populate_new_custom_tab Lock Custom mixer table until frameType is saved on board, next edit.

This commit is contained in:
Laurent Lalanne 2014-08-28 22:30:30 +02:00
parent 485600ab5d
commit d5c8e9a51e
2 changed files with 19 additions and 0 deletions

View File

@ -138,6 +138,12 @@
<property name="columnCount">
<number>12</number>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>50</number>
</attribute>

View File

@ -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<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
@ -206,6 +207,18 @@ void ConfigCustomWidget::refreshWidgetsValues(QString frameType)
setupUI(frameType);
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
Q_ASSERT(system);
QPointer<UAVObjectField> 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<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);