forked from qt-creator/qt-creator
QmlPreview: Don't use MainFileAspect if it doesn't exist
We only need to choose the main file if we're dealing with a qmlproject. Fixes: QTCREATORBUG-24056 Change-Id: I5b5dfa29a46fa07de7ee570fa033d978e72dfdb5 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -134,7 +134,7 @@ 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>();
|
||||
if (const auto aspect = runControl->aspect<QmlProjectManager::QmlMainFileAspect>()) {
|
||||
const QString mainScript = aspect->mainScript();
|
||||
const QString currentFile = aspect->currentFile();
|
||||
|
||||
@@ -150,6 +150,7 @@ LocalQmlPreviewSupport::LocalQmlPreviewSupport(ProjectExplorer::RunControl *runC
|
||||
commandLine.addArg(currentFile);
|
||||
runnable.setCommandLine(commandLine);
|
||||
}
|
||||
}
|
||||
|
||||
Utils::QtcProcess::addArg(&runnable.commandLineArguments,
|
||||
QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlPreviewServices,
|
||||
|
Reference in New Issue
Block a user