From 88d357e79ffae663cab26a7b4f98a47dc87fea97 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 22 Dec 2020 15:39:29 +0100 Subject: [PATCH] CMakeProjectManager: Select the expected CMakeLists.txt for targets When using locator with "cmo " do not select the deepest CMakeLists.txt in the stack. Fixes: QTCREATORBUG-25166 Change-Id: I25437c3ddc57b7bf12213aefa51eb5f4fd853326 Reviewed-by: Alessandro Portale --- src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp index 590ae7e7945..9cd00b92051 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp @@ -76,8 +76,8 @@ void CMakeTargetLocatorFilter::prepareSearch(const QString &entry) const int index = target.title.indexOf(entry); if (index >= 0) { const FilePath path = target.backtrace.isEmpty() ? cmakeProject->projectFilePath() - : target.backtrace.first().path; - const int line = target.backtrace.isEmpty() ? -1 : target.backtrace.first().line; + : target.backtrace.last().path; + const int line = target.backtrace.isEmpty() ? -1 : target.backtrace.last().line; QVariantMap extraData; extraData.insert("project", cmakeProject->projectFilePath().toString());