From af02d0ee97101e8d073b1906d4e000ad16db6166 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 22 Feb 2020 11:27:09 +0100 Subject: [PATCH] ProfileViewer: Fix treeview selection looking unselected on Left key When pressing the Left arrow key, we now travel to the parent_index() of the currently selected index. Our implementation of parent_index() was always returning an index with column 0, instead of using the same column as the current index. This prevented the selected item from looking selected. --- DevTools/ProfileViewer/ProfileModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DevTools/ProfileViewer/ProfileModel.cpp b/DevTools/ProfileViewer/ProfileModel.cpp index 27fe98cb02b..29a340d82f5 100644 --- a/DevTools/ProfileViewer/ProfileModel.cpp +++ b/DevTools/ProfileViewer/ProfileModel.cpp @@ -64,7 +64,7 @@ GUI::ModelIndex ProfileModel::parent_index(const GUI::ModelIndex& index) const if (!node.parent()->parent()) { for (int row = 0; row < m_profile.roots().size(); ++row) { if (m_profile.roots()[row].ptr() == node.parent()) { - return create_index(row, 0, node.parent()); + return create_index(row, index.column(), node.parent()); } } ASSERT_NOT_REACHED(); @@ -73,7 +73,7 @@ GUI::ModelIndex ProfileModel::parent_index(const GUI::ModelIndex& index) const for (int row = 0; row < node.parent()->parent()->children().size(); ++row) { if (node.parent()->parent()->children()[row].ptr() == node.parent()) - return create_index(row, 0, node.parent()); + return create_index(row, index.column(), node.parent()); } ASSERT_NOT_REACHED();