From 22d35f8a41258085f737078b499599606c910d0a Mon Sep 17 00:00:00 2001 From: "Srivats P." Date: Sun, 31 May 2015 21:21:46 +0530 Subject: [PATCH] Feature (contd.): Variable Fields - fixed bug where the correct validation/masks were not setup when adding a new VF or switching between protocols --- client/variablefieldswidget.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/variablefieldswidget.cpp b/client/variablefieldswidget.cpp index 56d2a7c..8eb06ea 100644 --- a/client/variablefieldswidget.cpp +++ b/client/variablefieldswidget.cpp @@ -160,6 +160,13 @@ void VariableFieldsWidget::on_protocolList_currentItemChanged( variableFieldList->addItem(vfItem); } + // While switching protocols, we want to setup the attrib group + // validation/ranges/masks for the current protocol, which is done + // by the field/type signal handlers - so clear field/type index + // now so that signals are emitted when we add/select a VF + field->setCurrentIndex(-1); + type->setCurrentIndex(-1); + lastSelectedProtocolIndex_ = protocolList->currentRow(); _exit: @@ -263,7 +270,7 @@ void VariableFieldsWidget::on_field_currentIndexChanged(int index) void VariableFieldsWidget::on_type_currentIndexChanged(int index) { - if (!protocolList->currentItem()) + if ((index < 0) || !protocolList->currentItem()) return; AbstractProtocol *proto = protocolList->currentItem()->data(Qt::UserRole)