forked from qt-creator/qt-creator
QmlPreview: Robustify preview runner a bit
Don't rely on qobject_cast not returning null for eternity. Change-Id: I0adede2f05a27e4f98ee47e737af38732f1e4c31 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -115,14 +115,15 @@ public:
|
|||||||
CommandLine cmd = commandLine();
|
CommandLine cmd = commandLine();
|
||||||
|
|
||||||
if (const auto aspect = runControl->aspect<QmlProjectManager::QmlMainFileAspect>()) {
|
if (const auto aspect = runControl->aspect<QmlProjectManager::QmlMainFileAspect>()) {
|
||||||
const auto currentTarget = runControl->target();
|
const auto qmlBuildSystem = qobject_cast<QmlProjectManager::QmlBuildSystem *>(
|
||||||
const auto qmlBuildSystem = qobject_cast<QmlProjectManager::QmlBuildSystem *>(currentTarget->buildSystem());
|
runControl->target()->buildSystem());
|
||||||
|
QTC_ASSERT(qmlBuildSystem, return);
|
||||||
|
|
||||||
const QString mainScript = aspect->mainScript;
|
const QString mainScript = aspect->mainScript;
|
||||||
const QString currentFile = aspect->currentFile;
|
const QString currentFile = aspect->currentFile;
|
||||||
|
|
||||||
const QString mainScriptFromProject = qmlBuildSystem->targetFile(
|
const QString mainScriptFromProject = qmlBuildSystem->targetFile(
|
||||||
FilePath::fromString(mainScript)).toString();
|
FilePath::fromString(mainScript)).path();
|
||||||
|
|
||||||
QStringList qmlProjectRunConfigurationArguments = cmd.splitArguments();
|
QStringList qmlProjectRunConfigurationArguments = cmd.splitArguments();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user