From 2f7e85ebcfaffee933d51a9ba841a37a634ea91f Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 9 Jul 2015 13:53:12 +0200 Subject: [PATCH] QmlDesigner: Change the priority of projects and kits First we try to find a project that contains the document. We fallback to the current project. If the kit of the active target is invalid we return 0. Before any newly created qml file used the fallback puppet. Change-Id: Ide3333455d85418459924e507f4f5e77afae4188 Reviewed-by: Tim Jenssen --- .../qmldesigner/components/integration/designdocument.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index 65dbe233da2..27a7e76842d 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -640,16 +640,14 @@ static bool isFileInProject(DesignDocument *designDocument, Project *project) static inline Kit *getActiveKit(DesignDocument *designDocument) { - Project *currentProject = ProjectTree::currentProject(); + ProjectExplorer::Project *currentProject = ProjectExplorer::SessionManager::projectForFile(designDocument->fileName()); if (!currentProject) - currentProject = SessionManager::projectForFile(Utils::FileName::fromString(designDocument->fileName())); + currentProject = ProjectExplorer::ProjectTree::currentProject(); if (!currentProject) return 0; - if (!isFileInProject(designDocument, currentProject)) - return 0; QObject::connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged, designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection); @@ -663,6 +661,8 @@ static inline Kit *getActiveKit(DesignDocument *designDocument) if (!target) return 0; + if (!target->kit()->isValid()) + return 0; QObject::connect(target, &Target::kitChanged, designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);