From c43f54fc55550a0c3ef62544e5f1ed8f81c51f33 Mon Sep 17 00:00:00 2001
From: Alice Russell <Alice.Russell@tessella.com>
Date: Tue, 11 Feb 2020 16:27:15 +0000
Subject: [PATCH] Re #27587 Add check to make sure selected item is not a
 nested group

When getting the function name if a nested group name is selected instead of a function it will return an empty string (the same as it does for top level groups)
---
 qt/widgets/common/src/SelectFunctionDialog.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qt/widgets/common/src/SelectFunctionDialog.cpp b/qt/widgets/common/src/SelectFunctionDialog.cpp
index 05d92008784..e371c641c42 100644
--- a/qt/widgets/common/src/SelectFunctionDialog.cpp
+++ b/qt/widgets/common/src/SelectFunctionDialog.cpp
@@ -172,7 +172,7 @@ SelectFunctionDialog::~SelectFunctionDialog() { delete m_form; }
 QString SelectFunctionDialog::getFunction() const {
   const auto searchText = m_form->searchBox->currentText();
   QList<QTreeWidgetItem *> items(m_form->fitTree->selectedItems());
-  if (items.size() == 1 && items[0]->parent() != nullptr) {
+  if (items.size() == 1 && items[0]->childCount() == 0) {
     return items[0]->text(0);
   } else if (m_form->searchBox->findText(searchText) >= 0) {
     return searchText;
-- 
GitLab