forked from qt-creator/qt-creator
QmlProject: Fix import of .qmlproject.user files from 2.1
We changed the semantics of an empty 'mainScript' in the .user file: In 2.1 it translated to 'use current file', while in 2.2 the default is now to use the file specified in .qmlproject. However, if there is no mainFile specified in .qmlproject we should fall back to the current file in editor. Reviewed-by: Christiaan Janssen
This commit is contained in:
@@ -248,7 +248,10 @@ QString QmlProjectRunConfiguration::mainScript() const
|
|||||||
return m_mainScriptFilename;
|
return m_mainScriptFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString path = qmlTarget()->qmlProject()->mainFile();
|
const QString path = qmlTarget()->qmlProject()->mainFile();
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
return m_currentFileFilename;
|
||||||
|
}
|
||||||
if (QFileInfo(path).isAbsolute()) {
|
if (QFileInfo(path).isAbsolute()) {
|
||||||
return path;
|
return path;
|
||||||
} else {
|
} else {
|
||||||
@@ -325,8 +328,11 @@ bool QmlProjectRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
return RunConfiguration::fromMap(map);
|
return RunConfiguration::fromMap(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProjectRunConfiguration::changeCurrentFile(Core::IEditor * /*editor*/)
|
void QmlProjectRunConfiguration::changeCurrentFile(Core::IEditor *editor)
|
||||||
{
|
{
|
||||||
|
if (editor) {
|
||||||
|
m_currentFileFilename = editor->file()->fileName();
|
||||||
|
}
|
||||||
updateEnabled();
|
updateEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user