From 9f17108e03b4aa4381ed485e0689766ccac0c129 Mon Sep 17 00:00:00 2001 From: tstellanova Date: Tue, 6 Aug 2013 08:05:47 -0700 Subject: [PATCH] ignoring UAS updates while slider has no param name --- src/ui/designer/QGCParamSlider.cc | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/ui/designer/QGCParamSlider.cc b/src/ui/designer/QGCParamSlider.cc index edba2c78c..6733c5790 100644 --- a/src/ui/designer/QGCParamSlider.cc +++ b/src/ui/designer/QGCParamSlider.cc @@ -92,29 +92,29 @@ void QGCParamSlider::refreshParamList() void QGCParamSlider::setActiveUAS(UASInterface* activeUas) { - if (activeUas) - { - if (uas) - { - disconnect(uas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant))); - } - - // Connect buttons and signals - connect(activeUas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant)), Qt::UniqueConnection); - uas = activeUas; - // Update current param value - //requestParameter(); + if (activeUas) { // Set param info - QString text = uas->getParamManager()->getParamInfo(parameterName); - if (text != "") - { - ui->infoLabel->setToolTip(text); - ui->infoLabel->show(); + if (!parameterName.isEmpty()) { + //disconnect from any existing uas signals + if (uas != activeUas) { + disconnect(uas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant))); + connect(activeUas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant)), Qt::UniqueConnection); + uas = activeUas; + } + + QString text = uas->getParamManager()->getParamInfo(parameterName); + if (text != "") { + ui->infoLabel->setToolTip(text); + ui->infoLabel->show(); + } + // Force-uncheck and hide label if no description is available + if (ui->editInfoCheckBox->isChecked()) { + showInfo((text.length() > 0)); + } } - // Force-uncheck and hide label if no description is available - if (ui->editInfoCheckBox->isChecked()) - { - showInfo((text.length() > 0)); + else { + //when parameter widgets are first loaded, they are disconnected from any parameter? + qWarning() << __FILE__ << ":" << __LINE__ << "slider has no parameterName??"; } } } -- 2.22.0