aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/python/pythonutils.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2025-01-20 14:21:46 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2025-01-20 16:55:10 +0000
commit30dc2e66dcd7ac092a04432aa92c39e8be025924 (patch)
tree082762f2e63e1680d0bba84dcbab3e96aef6ff73 /src/plugins/python/pythonutils.cpp
parentd38f7f74d4e38ba9bfe082fe89ad80da80b37a62 (diff)
ProjectExplorer: Add and make use of forwarding accessors in Project
Most accesses to activeTarget() are for getting to the active kit or build/deploy/run configuration. Simplify client code by adding convenience functions for that. No functional changes intended. Change-Id: Ide266712d19f960e4512672eb3bd00fc4d21b47b Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/python/pythonutils.cpp')
-rw-r--r--src/plugins/python/pythonutils.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp
index b2648fc7306..3cec49a2cd5 100644
--- a/src/plugins/python/pythonutils.cpp
+++ b/src/plugins/python/pythonutils.cpp
@@ -45,12 +45,10 @@ FilePath detectPython(const FilePath &documentPath)
FilePaths dirs = Environment::systemEnvironment().path();
if (project && project->mimeType() == Constants::C_PY_PROJECT_MIME_TYPE) {
- if (const Target *target = project->activeTarget()) {
- if (auto bc = qobject_cast<PythonBuildConfiguration *>(target->activeBuildConfiguration()))
- return bc->python();
- if (const std::optional<Interpreter> python = PythonKitAspect::python(target->kit()))
- return python->command;
- }
+ if (auto bc = qobject_cast<PythonBuildConfiguration *>(project->activeBuildConfiguration()))
+ return bc->python();
+ if (const std::optional<Interpreter> python = PythonKitAspect::python(project->activeKit()))
+ return python->command;
}
const FilePath userDefined = userDefinedPythonsForDocument().value(documentPath);