From 723c1ea33d7a8d09afe3692ba7388e013a5149dd Mon Sep 17 00:00:00 2001 From: xarkes Date: Sat, 19 Oct 2019 13:18:58 +0200 Subject: [PATCH] Automatically select the first line of xref (#1849) --- src/dialogs/XrefsDialog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dialogs/XrefsDialog.cpp b/src/dialogs/XrefsDialog.cpp index ff0e5f02..4c9c93fb 100644 --- a/src/dialogs/XrefsDialog.cpp +++ b/src/dialogs/XrefsDialog.cpp @@ -151,9 +151,11 @@ void XrefsDialog::fillRefsForAddress(RVA addr, QString name, bool whole_function qhelpers::adjustColumns(ui->fromTreeWidget, fromModel.columnCount(), 0); qhelpers::adjustColumns(ui->toTreeWidget, toModel.columnCount(), 0); - // try to select first item from refs or xrefs - if (!qhelpers::selectFirstItem(ui->toTreeWidget)) { - qhelpers::selectFirstItem(ui->fromTreeWidget); + // Automatically select the first line + if (toModel.hasIndex(0, 0)) { + ui->toTreeWidget->setCurrentIndex(toModel.index(0, 0)); + } else if (fromModel.hasIndex(0, 0)) { + ui->fromTreeWidget->setCurrentIndex(fromModel.index(0, 0)); } }