Commit f5716f05 authored by Kai Koehne's avatar Kai Koehne

QmlDump: Get right Qt version for .qmlproject

We're using a QObject property to get the Qt Version Id: QmlDumpTool
is in Qt4ProjectManager, which shouldn't have a dependency to QmlProjectManager.

Reviewed-by: Christian Kamm
parent 1d3c08da
......@@ -67,6 +67,7 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Internal::QmlProjectTarge
m_isEnabled(false)
{
ctor();
updateQtVersions();
}
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Internal::QmlProjectTarget *parent, QmlProjectRunConfiguration *source) :
......@@ -78,6 +79,7 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Internal::QmlProjectTarge
{
ctor();
setMainScript(source->m_scriptFile);
updateQtVersions();
}
bool QmlProjectRunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *bc) const
......@@ -158,6 +160,11 @@ QString QmlProjectRunConfiguration::workingDirectory() const
return projectFile.absolutePath();
}
int QmlProjectRunConfiguration::qtVersionId() const
{
return m_qtVersionId;
}
Qt4ProjectManager::QtVersion *QmlProjectRunConfiguration::qtVersion() const
{
if (m_qtVersionId == -1)
......
......@@ -62,6 +62,9 @@ class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplor
Q_OBJECT
friend class Internal::QmlProjectRunConfigurationFactory;
// used in qmldumptool.cpp
Q_PROPERTY(int qtVersionId READ qtVersionId)
public:
QmlProjectRunConfiguration(Internal::QmlProjectTarget *parent);
virtual ~QmlProjectRunConfiguration();
......@@ -74,6 +77,7 @@ public:
QString observerPath() const;
QStringList viewerArguments() const;
QString workingDirectory() const;
int qtVersionId() const;
Qt4ProjectManager::QtVersion *qtVersion() const;
// RunConfiguration
......
......@@ -36,8 +36,10 @@
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/runconfiguration.h>
#include <qtconcurrent/runextensions.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <utils/qtcassert.h>
#include <QDesktopServices>
#include <QCoreApplication>
#include <QDir>
......@@ -147,6 +149,17 @@ static QtVersion *qtVersionForProject(ProjectExplorer::Project *project)
return 0;
}
if (project && project->id() == QLatin1String("QmlProjectManager.QmlProject")) {
// We cannot access the QmlProject interfaces here, therefore use the metatype system
QTC_ASSERT(project->activeTarget() && project->activeTarget()->activeRunConfiguration(), return 0);
QVariant variant = project->activeTarget()->activeRunConfiguration()->property("qtVersionId");
QTC_ASSERT(variant.isValid() && variant.canConvert(QVariant::Int), return 0);
QtVersion *version = QtVersionManager::instance()->version(variant.toInt());
if (version && version->isValid())
return version;
return 0;
}
// else, find any desktop Qt version that has qmldump, or - if there isn't any -
// one that could build it
QtVersion *desktopQt = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment