Commit fbd3f735 authored by Kai Koehne's avatar Kai Koehne

QmlProject: Update code model if kit configuration changes

Update code model if e.g. the Qt version in the active kit changes.

Task-number: QTCREATORBUG-10656
Change-Id: I4263833c23c2b00035d15faa9725adbb734f8366
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent b4785dde
......@@ -108,7 +108,8 @@ QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
: m_manager(manager),
m_fileName(fileName),
m_defaultImport(UnknownImport),
m_modelManager(QmlJS::ModelManagerInterface::instance())
m_modelManager(QmlJS::ModelManagerInterface::instance()),
m_activeTarget(0)
{
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_QMLJS));
......@@ -142,7 +143,19 @@ void QmlProject::addedTarget(ProjectExplorer::Target *target)
addedRunConfiguration(rc);
}
void QmlProject::onActiveTargetChanged(ProjectExplorer::Target * /*target*/)
void QmlProject::onActiveTargetChanged(ProjectExplorer::Target *target)
{
if (m_activeTarget)
disconnect(m_activeTarget, SIGNAL(kitChanged()), this, SLOT(onKitChanged()));
m_activeTarget = target;
if (m_activeTarget)
connect(target, SIGNAL(kitChanged()), this, SLOT(onKitChanged()));
// make sure e.g. the default qml imports are adapted
refresh(Configuration);
}
void QmlProject::onKitChanged()
{
// make sure e.g. the default qml imports are adapted
refresh(Configuration);
......@@ -402,6 +415,11 @@ bool QmlProject::fromMap(const QVariantMap &map)
connect(this, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
this, SLOT(onActiveTargetChanged(ProjectExplorer::Target*)));
// make sure we get updates on kit changes
m_activeTarget = activeTarget();
if (m_activeTarget)
connect(m_activeTarget, SIGNAL(kitChanged()), this, SLOT(onKitChanged()));
return true;
}
......
......@@ -98,6 +98,7 @@ private slots:
void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
void addedTarget(ProjectExplorer::Target *target);
void onActiveTargetChanged(ProjectExplorer::Target *target);
void onKitChanged();
void addedRunConfiguration(ProjectExplorer::RunConfiguration *);
protected:
......@@ -114,6 +115,7 @@ private:
QString m_projectName;
QmlImport m_defaultImport;
QmlJS::ModelManagerInterface *m_modelManager;
ProjectExplorer::Target *m_activeTarget;
// plain format
QStringList m_files;
......
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