CMakeProjectManager: Select the expected CMakeLists.txt for targets

When using locator with "cmo <target>" do not select the deepest
CMakeLists.txt in the stack.

Fixes: QTCREATORBUG-25166
Change-Id: I25437c3ddc57b7bf12213aefa51eb5f4fd853326
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2020-12-22 15:39:29 +01:00
parent 15a7e08eda
commit 88d357e79f

View File

@@ -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());