forked from qt-creator/qt-creator
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 <christian.stenger@qt.io>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user