diff options
| author | David Schulz <[email protected]> | 2024-04-17 15:08:34 +0200 |
|---|---|---|
| committer | David Schulz <[email protected]> | 2024-04-22 11:36:12 +0000 |
| commit | 620f6fd39ba42189ab5841c12cd8c7fcd8b93e56 (patch) | |
| tree | ce9efe308e6f6438dcbef98204828ed0b19c056c /src/plugins/python/pythonbuildconfiguration.cpp | |
| parent | b5740eb0c613a9edf9e28d60d07bae4fe4921de6 (diff) | |
Python: offer to install pyside also in qml files
This shwos the same editor toolbar as in the python editor that offers
to install pyside, if the qml file can be associated to a python project
and the configured python for that project does not contain a valid
pyside.
Change-Id: Id05a2621aec9d78c4a22e61830813cd261eda4fc
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/plugins/python/pythonbuildconfiguration.cpp')
| -rw-r--r-- | src/plugins/python/pythonbuildconfiguration.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/plugins/python/pythonbuildconfiguration.cpp b/src/plugins/python/pythonbuildconfiguration.cpp index d13e8cbc6ae..1255af1442b 100644 --- a/src/plugins/python/pythonbuildconfiguration.cpp +++ b/src/plugins/python/pythonbuildconfiguration.cpp @@ -37,6 +37,7 @@ #include <utils/detailswidget.h> #include <utils/futuresynchronizer.h> #include <utils/layoutbuilder.h> +#include <utils/mimeconstants.h> #include <utils/qtcprocess.h> using namespace ProjectExplorer; @@ -265,7 +266,7 @@ PythonBuildConfiguration::PythonBuildConfiguration(Target *target, const Id &id) updateCacheAndEmitEnvironmentChanged(); - connect(&pySideInstaller(), + connect(&PySideInstaller::instance(), &PySideInstaller::pySideInstalled, this, &PythonBuildConfiguration::handlePythonUpdated); @@ -273,13 +274,7 @@ PythonBuildConfiguration::PythonBuildConfiguration(Target *target, const Id &id) auto update = [this] { if (isActive()) { m_buildSystem->emitBuildSystemUpdated(); - const FilePaths files = project()->files(Project::AllFiles); - for (const FilePath &file : files) { - if (auto doc = qobject_cast<PythonDocument *>( - Core::DocumentModel::documentForFilePath(file))) { - doc->updatePython(m_python); - } - } + updateDocuments(); } }; connect(target, &Target::activeBuildConfigurationChanged, this, update); @@ -338,16 +333,23 @@ void PythonBuildConfiguration::updatePython(const FilePath &python) m_python = python; if (auto buildStep = buildSteps()->firstOfType<PySideBuildStep>()) buildStep->checkForPySide(python); + updateDocuments(); + m_buildSystem->requestParse(); +} + +void PythonBuildConfiguration::updateDocuments() +{ if (isActive()) { const FilePaths files = project()->files(Project::AllFiles); for (const FilePath &file : files) { - if (auto doc = qobject_cast<PythonDocument *>( - Core::DocumentModel::documentForFilePath(file))) { - doc->updatePython(m_python); + if (auto doc = TextEditor::TextDocument::textDocumentForFilePath(file)) { + if (auto pyDoc = qobject_cast<PythonDocument *>(doc)) + pyDoc->updatePython(m_python); + else if (doc->mimeType() == Utils::Constants::QML_MIMETYPE) + PySideInstaller::instance().checkPySideInstallation(m_python, doc); } } } - m_buildSystem->requestParse(); } void PythonBuildConfiguration::handlePythonUpdated(const FilePath &python) |
