qmlproject: fix qmlViewerAspect

- add its own settings key so it gets saved into the project settings
- read the correct placeholder text, commandLineGetter is set too late
  and would also create a loop (qmlViewerAspect is used to get it)

Change-Id: Iee3458cfe84e3f6b6750aa14d9d89347da21b37c
Reviewed-by: Burak Hancerli <burak.hancerli@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2023-01-12 14:05:09 +01:00
parent f561740a0b
commit 2df52c4b8b
2 changed files with 3 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ namespace QmlProjectManager {
namespace Constants {
const char QML_PROJECT_ID[] = "QmlProjectManager.QmlProject";
const char QML_VIEWER_KEY[] = "QmlProjectManager.QmlRunConfiguration.QDeclarativeViewer";
const char QML_VIEWER_ARGUMENTS_KEY[] = "QmlProjectManager.QmlRunConfiguration.QDeclarativeViewerArguments";
const char QML_VIEWER_TARGET_DISPLAY_NAME[] = "QML Viewer";
const char QML_MAINSCRIPT_KEY[] = "QmlProjectManager.QmlRunConfiguration.MainScript";

View File

@@ -73,9 +73,10 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
{
m_qmlViewerAspect = addAspect<StringAspect>();
m_qmlViewerAspect->setLabelText(tr("QML Viewer:"));
m_qmlViewerAspect->setPlaceHolderText(commandLine().executable().toString());
m_qmlViewerAspect->setPlaceHolderText(qmlRuntimeFilePath().toUserOutput());
m_qmlViewerAspect->setDisplayStyle(StringAspect::LineEditDisplay);
m_qmlViewerAspect->setHistoryCompleter("QmlProjectManager.viewer.history");
m_qmlViewerAspect->setSettingsKey(Constants::QML_VIEWER_KEY);
auto argumentAspect = addAspect<ArgumentsAspect>(macroExpander());
argumentAspect->setSettingsKey(Constants::QML_VIEWER_ARGUMENTS_KEY);