summaryrefslogtreecommitdiff
path: root/src/plugins/python/pythonutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/python/pythonutils.cpp')
-rw-r--r--src/plugins/python/pythonutils.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp
index 5b37cdbf6b..1ddad5cfcf 100644
--- a/src/plugins/python/pythonutils.cpp
+++ b/src/plugins/python/pythonutils.cpp
@@ -146,5 +146,16 @@ QString pythonName(const FilePath &pythonPath)
return name;
}
+PythonProject *pythonProjectForFile(const FilePath &pythonFile)
+{
+ for (ProjectExplorer::Project *project : ProjectExplorer::SessionManager::projects()) {
+ if (auto pythonProject = qobject_cast<PythonProject *>(project)) {
+ if (pythonProject->isKnownFile(pythonFile))
+ return pythonProject;
+ }
+ }
+ return nullptr;
+}
+
} // namespace Internal
} // namespace Python