From 1858a52cb3f303b38cabcf048678a8f790e5d00d Mon Sep 17 00:00:00 2001 From: Bryant Date: Sat, 8 Jun 2013 16:13:18 -0700 Subject: [PATCH] The QuickView now properly resets after the last UAS is deleted. --- src/ui/uas/UASQuickView.cc | 11 ++++++++++- src/ui/uas/UASQuickView.h | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ui/uas/UASQuickView.cc b/src/ui/uas/UASQuickView.cc index b433bdd37f..936bafeadc 100644 --- a/src/ui/uas/UASQuickView.cc +++ b/src/ui/uas/UASQuickView.cc @@ -153,11 +153,20 @@ void UASQuickView::setActiveUAS(UASInterface* uas) { uasPropertyList.clear(); uasPropertyValueMap.clear(); + foreach (UASQuickViewItem* i, uasPropertyToLabelMap.values()) + { + i->deleteLater(); + } uasPropertyToLabelMap.clear(); + updateTimer->stop(); - this->actions().clear(); + foreach (QAction* i, this->actions()) + { + i->deleteLater(); + } } + // Update the UAS to point to the new one. this->uas = uas; if (this->uas) diff --git a/src/ui/uas/UASQuickView.h b/src/ui/uas/UASQuickView.h index 9c4d2bb122..943fa8c665 100644 --- a/src/ui/uas/UASQuickView.h +++ b/src/ui/uas/UASQuickView.h @@ -17,6 +17,10 @@ public: UASQuickView(QWidget *parent = 0); void addSource(MAVLinkDecoder *decoder); private: + /** + * Adds a default set of actions to the widget's menu. + */ + void addDefaultActions(); UASInterface *uas; /** List of enabled properties */ -- GitLab