diff --git a/src/plugins/python/pyside.cpp b/src/plugins/python/pyside.cpp index 6965305f2e6..2bdfebc2783 100644 --- a/src/plugins/python/pyside.cpp +++ b/src/plugins/python/pyside.cpp @@ -106,6 +106,10 @@ void PySideInstaller::installPyside(const Utils::FilePath &python, auto install = new PipInstallTask(python); connect(install, &PipInstallTask::finished, install, &QObject::deleteLater); + connect(install, &PipInstallTask::finished, this, [=](bool success){ + if (success) + emit pySideInstalled(python, pySide); + }); install->setPackage(PipPackage(pySide)); install->run(); } diff --git a/src/plugins/python/pyside.h b/src/plugins/python/pyside.h index f749399903f..d396c726b4a 100644 --- a/src/plugins/python/pyside.h +++ b/src/plugins/python/pyside.h @@ -40,13 +40,17 @@ namespace Internal { class PySideInstaller : public QObject { - Q_DECLARE_TR_FUNCTIONS(Python::Internal::PySideInstaller) + Q_OBJECT public: static PySideInstaller *instance(); static void checkPySideInstallation(const Utils::FilePath &python, TextEditor::TextDocument *document); + +signals: + void pySideInstalled(const Utils::FilePath &python, const QString &pySide); + private: PySideInstaller(); diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index 9882cfb5fb0..5f63c19091f 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -202,6 +202,12 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target, Id id) setRunnableModifier([](Runnable &r) { r.workingDirectory = r.workingDirectory.onDevice(r.command.executable()); }); + + connect(PySideInstaller::instance(), &PySideInstaller::pySideInstalled, this, + [this](const FilePath &python) { + if (python == aspect()->currentInterpreter().command) + checkForPySide(python); + }); } PythonRunConfiguration::~PythonRunConfiguration() @@ -209,9 +215,8 @@ PythonRunConfiguration::~PythonRunConfiguration() qDeleteAll(m_extraCompilers); } -void PythonRunConfiguration::currentInterpreterChanged() +void PythonRunConfiguration::checkForPySide(const FilePath &python) { - const FilePath python = aspect()->currentInterpreter().command; BuildStepList *buildSteps = target()->activeBuildConfiguration()->buildSteps(); Utils::FilePath pySideProjectPath; @@ -255,6 +260,12 @@ void PythonRunConfiguration::currentInterpreterChanged() if (auto pySideBuildStep = buildSteps->firstOfType()) pySideBuildStep->updatePySideProjectPath(pySideProjectPath); +} + +void PythonRunConfiguration::currentInterpreterChanged() +{ + const FilePath python = aspect()->currentInterpreter().command; + checkForPySide(python); for (FilePath &file : project()->files(Project::AllFiles)) { if (auto document = TextEditor::TextDocument::textDocumentForFilePath(file)) { diff --git a/src/plugins/python/pythonrunconfiguration.h b/src/plugins/python/pythonrunconfiguration.h index 5394896b948..89bddac83e2 100644 --- a/src/plugins/python/pythonrunconfiguration.h +++ b/src/plugins/python/pythonrunconfiguration.h @@ -43,6 +43,7 @@ public: QList extraCompilers() const; private: + void checkForPySide(const Utils::FilePath &python); void updateExtraCompilers(); Utils::FilePath m_pySideUicPath;