QmlDesigner.DesignDocument: Fixing getActiveQtVersion()

The function currentProject() returns the current project based
on the current project node.
If the current document was newly created by a wizard, this did not work.
We use SessionManager::projectForFile() as a fallback.

For Qt Creator 3.2 we plan to unify this functionality with die Qml
code model.

Change-Id: I296224671a0b496fbf6fd0d8e62e74c28b4f9abb
Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
Thomas Hartmann
2014-03-05 15:17:43 +01:00
parent fed3e021e5
commit 8d6e3d22a9

View File

@@ -43,6 +43,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/session.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionmanager.h>
@@ -651,6 +652,9 @@ static inline QtSupport::BaseQtVersion *getActiveQtVersion(DesignDocument *desig
ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
ProjectExplorer::Project *currentProject = projectExplorer->currentProject();
if (!currentProject)
currentProject = ProjectExplorer::SessionManager::projectForFile(designDocument->fileName());
if (!currentProject)
return 0;