diff options
author | Tim Jenssen <tim.jenssen@qt.io> | 2020-05-27 18:59:53 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2020-05-27 18:59:53 +0200 |
commit | b193892fd1289bd8a995cd609ead33f925b75ee1 (patch) | |
tree | 4d03bf8ea45a9ab542eb6ab129e56a82b860e19c /src/plugins/qmlpreview/qmlpreviewruncontrol.cpp | |
parent | aa79d30b83fc79e8e18af4da0062ddf21fcd201f (diff) | |
parent | 13ad8163080153cb5d1ea39238069b5cca8f9651 (diff) |
Merge remote-tracking branch 'origin/4.12' into qds-1.50qds-1.50
Change-Id: I8e4155aa2a0a8c7f7405dd79e856380011e23a33
Diffstat (limited to 'src/plugins/qmlpreview/qmlpreviewruncontrol.cpp')
-rw-r--r-- | src/plugins/qmlpreview/qmlpreviewruncontrol.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index 9f22796689..c513a580f3 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -134,21 +134,22 @@ LocalQmlPreviewSupport::LocalQmlPreviewSupport(ProjectExplorer::RunControl *runC const auto currentTarget = runControl->target(); const auto *qmlBuildSystem = qobject_cast<QmlProjectManager::QmlBuildSystem *>(currentTarget->buildSystem()); - const auto aspect = runControl->aspect<QmlProjectManager::QmlMainFileAspect>(); - const QString mainScript = aspect->mainScript(); - const QString currentFile = aspect->currentFile(); - - const QString mainScriptFromProject = qmlBuildSystem->targetFile( - Utils::FilePath::fromString(mainScript)).toString(); - - const QString currentFileFromProject = qmlBuildSystem->targetFile( - Utils::FilePath::fromString(currentFile)).toString(); - - if (!currentFile.isEmpty() && qmlProjectRunConfigurationArguments.last().contains(mainScriptFromProject)) { - qmlProjectRunConfigurationArguments.removeLast(); - auto commandLine = Utils::CommandLine(runnable.commandLine().executable(), qmlProjectRunConfigurationArguments); - commandLine.addArg(currentFile); - runnable.setCommandLine(commandLine); + if (const auto aspect = runControl->aspect<QmlProjectManager::QmlMainFileAspect>()) { + const QString mainScript = aspect->mainScript(); + const QString currentFile = aspect->currentFile(); + + const QString mainScriptFromProject = qmlBuildSystem->targetFile( + Utils::FilePath::fromString(mainScript)).toString(); + + const QString currentFileFromProject = qmlBuildSystem->targetFile( + Utils::FilePath::fromString(currentFile)).toString(); + + if (!currentFile.isEmpty() && qmlProjectRunConfigurationArguments.last().contains(mainScriptFromProject)) { + qmlProjectRunConfigurationArguments.removeLast(); + auto commandLine = Utils::CommandLine(runnable.commandLine().executable(), qmlProjectRunConfigurationArguments); + commandLine.addArg(currentFile); + runnable.setCommandLine(commandLine); + } } Utils::QtcProcess::addArg(&runnable.commandLineArguments, |