From d28cf2a070bd7bc44149b54821bebce48e53bba2 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Thu, 15 Mar 2018 21:16:57 +0100 Subject: [PATCH] LP-567 fix spurious Settings node expand when selecting a Data item was due a regression in the parent() method --- .../src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ground/gcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp b/ground/gcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp index a4a41b377..8613650bd 100644 --- a/ground/gcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp +++ b/ground/gcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp @@ -295,11 +295,10 @@ QModelIndex UAVObjectTreeModel::parent(const QModelIndex &index) const return QModelIndex(); } - TreeItem *item = static_cast(index.internalPointer()); + TreeItem *childItem = static_cast(index.internalPointer()); + TreeItem *parentItem = childItem->parent(); - TreeItem *parentItem = item->parent(); - if (!parentItem) { - // item is root has no parent... + if (parentItem == m_rootItem) { return QModelIndex(); }