mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-792
Make sure m_currentBoardId is initialized to a known value that we can use to check to see if we actually have a board id or not. Only set up limits for UAVObjects bound to combo box if we have a board id that is not set to the default value.
This commit is contained in:
parent
2b3aab41c4
commit
5c085823cf
@ -32,7 +32,7 @@
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
|
||||
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent), m_isConnected(false), m_isWidgetUpdatesAllowed(true),
|
||||
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent), m_currentBoardId(-1), m_isConnected(false), m_isWidgetUpdatesAllowed(true),
|
||||
m_saveButton(NULL), m_isDirty(false), m_outOfLimitsStyle("background-color: rgb(255, 0, 0);"), m_realtimeUpdateTimer(NULL)
|
||||
{
|
||||
m_pluginManager = ExtensionSystem::PluginManager::instance();
|
||||
@ -275,7 +275,7 @@ void ConfigTaskWidget::refreshWidgetsValues(UAVObject *obj)
|
||||
|
||||
bool dirtyBack = isDirty();
|
||||
emit refreshWidgetsValuesRequested();
|
||||
foreach(WidgetBinding * binding, m_widgetBindingsPerObject.values(obj)) {
|
||||
foreach(WidgetBinding * binding, obj == NULL ? m_widgetBindingsPerObject.values() : m_widgetBindingsPerObject.values(obj)) {
|
||||
if (binding->isEnabled() && binding->field() != NULL && binding->widget() != NULL) {
|
||||
setWidgetFromField(binding->widget(), binding->field(), binding);
|
||||
}
|
||||
@ -978,9 +978,16 @@ void ConfigTaskWidget::loadWidgetLimits(QWidget *widget, UAVObjectField *field,
|
||||
cb->clear();
|
||||
QStringList option = field->getOptions();
|
||||
if (hasLimits) {
|
||||
foreach(QString str, option) {
|
||||
if (field->isWithinLimits(str, index, m_currentBoardId)) {
|
||||
cb->addItem(str);
|
||||
// Only add options to combo box if we have a board id to check limits for.
|
||||
// We could enter this method while there is no board connected and without
|
||||
// this check, we would add all the board dependent options whether they were
|
||||
// valid or not. Ultimately this method will be called again when the connected
|
||||
// signal is handled.
|
||||
if(m_currentBoardId > -1) {
|
||||
foreach(QString str, option) {
|
||||
if (field->isWithinLimits(str, index, m_currentBoardId)) {
|
||||
cb->addItem(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user