Merge remote-tracking branch 'origin/12.0' into qds/dev

Change-Id: Iefea658312bba6675eadce23fb8dc92f9207ea0e
This commit is contained in:
Tim Jenssen
2023-11-01 16:17:04 +01:00
3132 changed files with 89695 additions and 65436 deletions

View File

@@ -1,31 +1,31 @@
{
\"Name\" : \"QmlProjectManager\",
\"Version\" : \"$$QTCREATOR_VERSION\",
\"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
\"Vendor\" : \"The Qt Company Ltd\",
\"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR The Qt Company Ltd\",
\"License\" : [ \"Commercial Usage\",
\"\",
\"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\",
\"\",
\"GNU General Public License Usage\",
\"\",
\"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\"
"Name" : "QmlProjectManager",
"Version" : "${IDE_VERSION}",
"CompatVersion" : "${IDE_VERSION_COMPAT}",
"Vendor" : "The Qt Company Ltd",
"Copyright" : "(C) ${IDE_COPYRIGHT_YEAR} The Qt Company Ltd",
"License" : [ "Commercial Usage",
"",
"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.",
"",
"GNU General Public License Usage",
"",
"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html."
],
\"Category\" : \"Qt Quick\",
\"Description\" : \"Qt Quick support\",
\"Url\" : \"http://www.qt.io\",
$$dependencyList,
"Category" : "Qt Quick",
"Description" : "Qt Quick support",
"Url" : "http://www.qt.io",
${IDE_PLUGIN_DEPENDENCIES},
\"Mimetypes\" : [
\"<?xml version=\'1.0\'?>\",
"Mimetypes" : [
"<?xml version='1.0'?>",
\"<mime-info xmlns=\'http://www.freedesktop.org/standards/shared-mime-info\'>\",
\" <mime-type type=\'application/x-qmlproject\'>\",
\" <sub-class-of type=\'text/x-qml\'/>\",
\" <comment>QML Project file</comment>\",
\" <glob pattern=\'*.qmlproject\'/>\",
\" </mime-type>\",
\"</mime-info>\"
"<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>",
" <mime-type type='application/x-qmlproject'>",
" <sub-class-of type='text/x-qml'/>",
" <comment>QML Project file</comment>",
" <glob pattern='*.qmlproject'/>",
" </mime-type>",
"</mime-info>"
]
}

View File

@@ -44,9 +44,9 @@ QString jsonToQmlProject(const QJsonObject &rootObject)
auto appendArray = [&appendItem](const QString &key, const QStringList &vals) {
QString finalString;
foreach (const QString &value, vals) {
for (const QString &value : vals)
finalString.append("\"").append(value).append("\"").append(",");
}
finalString.remove(finalString.length() - 1, 1);
finalString.prepend("[ ").append(" ]");
appendItem(key, finalString, false);
@@ -107,9 +107,9 @@ QString jsonToQmlProject(const QJsonObject &rootObject)
// append Environment object
startObject("Environment");
foreach (const QString &key, environmentConfig.keys()) {
for (const QString &key : environmentConfig.keys())
appendItem(key, environmentConfig[key].toString(), true);
}
endObject();
// append ShaderTool object
@@ -154,9 +154,9 @@ QJsonObject qmlProjectTojson(const Utils::FilePath &projectFile)
auto nodeToJsonObject = [](const QmlJS::SimpleReaderNode::Ptr &node) {
QJsonObject tObj;
foreach (const QString &childPropName, node->propertyNames()) {
for (const QString &childPropName : node->propertyNames())
tObj.insert(childPropName, node->property(childPropName).value.toJsonValue());
}
return tObj;
};

View File

@@ -137,9 +137,9 @@ Utils::EnvironmentItems QmlProjectItem::environment() const
{
Utils::EnvironmentItems envItems;
QJsonObject envVariables = m_project["environment"].toObject();
foreach (const QString &variableName, envVariables.keys()) {
const QStringList variableNames = envVariables.keys();
for (const QString &variableName : variableNames)
envItems.append(Utils::EnvironmentItem(variableName, envVariables[variableName].toString()));
}
return envItems;
}

View File

@@ -27,7 +27,7 @@
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitaspects.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>

View File

@@ -37,8 +37,8 @@ static bool caseInsensitiveLessThan(const FilePath &s1, const FilePath &s2)
return s1.toString().toCaseFolded() < s2.toString().toCaseFolded();
}
QmlMainFileAspect::QmlMainFileAspect(Target *target)
: m_target(target)
QmlMainFileAspect::QmlMainFileAspect(AspectContainer *container)
: BaseAspect(container)
, m_scriptFile(M_CURRENT_FILE)
{
addDataExtractor(this, &QmlMainFileAspect::mainScript, &Data::mainScript);
@@ -70,12 +70,12 @@ void QmlMainFileAspect::addToLayout(Layouting::LayoutItem &parent)
parent.addItems({Tr::tr("Main QML file:"), m_fileListCombo.data()});
}
void QmlMainFileAspect::toMap(QVariantMap &map) const
void QmlMainFileAspect::toMap(Store &map) const
{
map.insert(Constants::QML_MAINSCRIPT_KEY, m_scriptFile);
}
void QmlMainFileAspect::fromMap(const QVariantMap &map)
void QmlMainFileAspect::fromMap(const Store &map)
{
m_scriptFile = map.value(Constants::QML_MAINSCRIPT_KEY, M_CURRENT_FILE).toString();
@@ -158,6 +158,11 @@ void QmlMainFileAspect::setMainScript(int index)
}
}
void QmlMainFileAspect::setTarget(ProjectExplorer::Target *target)
{
m_target = target;
}
void QmlMainFileAspect::setScriptSource(MainScriptSource source, const QString &settingsPath)
{
if (source == FileInEditor) {

View File

@@ -27,7 +27,7 @@ class QMLPROJECTMANAGER_EXPORT QmlMainFileAspect : public Utils::BaseAspect
Q_OBJECT
public:
explicit QmlMainFileAspect(ProjectExplorer::Target *target);
explicit QmlMainFileAspect(Utils::AspectContainer *container = nullptr);
~QmlMainFileAspect() override;
enum MainScriptSource {
@@ -43,13 +43,14 @@ public:
};
void addToLayout(Layouting::LayoutItem &parent) final;
void toMap(QVariantMap &map) const final;
void fromMap(const QVariantMap &map) final;
void toMap(Utils::Store &map) const final;
void fromMap(const Utils::Store &map) final;
void updateFileComboBox();
MainScriptSource mainScriptSource() const;
void setMainScript(int index);
void setTarget(ProjectExplorer::Target *target);
void setScriptSource(MainScriptSource source, const QString &settingsPath = QString());
Utils::FilePath mainScript() const;

View File

@@ -14,6 +14,11 @@
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/target.h>
using namespace ProjectExplorer;
using namespace Utils;
namespace QmlProjectManager {
static bool isMultilanguagePresent()
{
const QVector<ExtensionSystem::PluginSpec *> &specs = ExtensionSystem::PluginManager::plugins();
@@ -24,7 +29,7 @@ static bool isMultilanguagePresent()
!= specs.cend();
}
static Utils::FilePath getMultilanguageDatabaseFilePath(ProjectExplorer::Target *target)
static FilePath getMultilanguageDatabaseFilePath(ProjectExplorer::Target *target)
{
if (target) {
auto filePath = target->project()->projectDirectory().pathAppended("translations.db");
@@ -48,11 +53,8 @@ static QObject *getPreviewPlugin()
return nullptr;
}
namespace QmlProjectManager {
QmlMultiLanguageAspect::QmlMultiLanguageAspect(ProjectExplorer::Target *target)
: m_target(target)
QmlMultiLanguageAspect::QmlMultiLanguageAspect(AspectContainer *container)
: BoolAspect(container)
{
setVisible(isMultilanguagePresent());
setSettingsKey(Constants::USE_MULTILANGUAGE_KEY);
@@ -60,14 +62,13 @@ QmlMultiLanguageAspect::QmlMultiLanguageAspect(ProjectExplorer::Target *target)
setToolTip(Tr::tr("Reads translations from MultiLanguage plugin."));
setDefaultValue(!databaseFilePath().isEmpty());
QVariantMap getDefaultValues;
Store getDefaultValues;
fromMap(getDefaultValues);
addDataExtractor(this, &QmlMultiLanguageAspect::origin, &Data::origin);
connect(this, &BoolAspect::changed, this, [this] {
for (ProjectExplorer::RunControl *runControl :
ProjectExplorer::ProjectExplorerPlugin::allRunControls()) {
for (RunControl *runControl : ProjectExplorerPlugin::allRunControls()) {
if (auto aspect = runControl->aspect<QmlMultiLanguageAspect>()) {
if (auto origin = aspect->origin; origin == this)
runControl->initiateStop();
@@ -80,6 +81,11 @@ QmlMultiLanguageAspect::~QmlMultiLanguageAspect()
{
}
void QmlMultiLanguageAspect::setTarget(Target *target)
{
m_target = target;
}
void QmlMultiLanguageAspect::setCurrentLocale(const QString &locale)
{
if (m_currentLocale == locale)
@@ -101,14 +107,14 @@ Utils::FilePath QmlMultiLanguageAspect::databaseFilePath() const
return m_databaseFilePath;
}
void QmlMultiLanguageAspect::toMap(QVariantMap &map) const
void QmlMultiLanguageAspect::toMap(Store &map) const
{
BoolAspect::toMap(map);
if (!m_currentLocale.isEmpty())
map.insert(Constants::LAST_USED_LANGUAGE, m_currentLocale);
}
void QmlMultiLanguageAspect::fromMap(const QVariantMap &map)
void QmlMultiLanguageAspect::fromMap(const Store &map)
{
BoolAspect::fromMap(map);
setCurrentLocale(map.value(Constants::LAST_USED_LANGUAGE, "en").toString());
@@ -116,19 +122,19 @@ void QmlMultiLanguageAspect::fromMap(const QVariantMap &map)
QmlMultiLanguageAspect *QmlMultiLanguageAspect::current()
{
if (auto project = ProjectExplorer::ProjectManager::startupProject())
if (auto project = ProjectManager::startupProject())
return current(project);
return {};
}
QmlMultiLanguageAspect *QmlMultiLanguageAspect::current(ProjectExplorer::Project *project)
QmlMultiLanguageAspect *QmlMultiLanguageAspect::current(Project *project)
{
if (auto target = project->activeTarget())
return current(target);
return {};
}
QmlMultiLanguageAspect *QmlMultiLanguageAspect::current(ProjectExplorer::Target *target)
QmlMultiLanguageAspect *QmlMultiLanguageAspect::current(Target *target)
{
if (!target)
return {};

View File

@@ -15,14 +15,16 @@ class QMLPROJECTMANAGER_EXPORT QmlMultiLanguageAspect : public Utils::BoolAspect
{
Q_OBJECT
public:
explicit QmlMultiLanguageAspect(ProjectExplorer::Target *target);
explicit QmlMultiLanguageAspect(Utils::AspectContainer *container = nullptr);
~QmlMultiLanguageAspect() override;
void setTarget(ProjectExplorer::Target *target);
QString currentLocale() const;
void setCurrentLocale(const QString &locale);
Utils::FilePath databaseFilePath() const;
void toMap(QVariantMap &map) const final;
void fromMap(const QVariantMap &map) final;
void toMap(Utils::Store &map) const final;
void fromMap(const Utils::Store &map) final;
static QmlMultiLanguageAspect *current();
static QmlMultiLanguageAspect *current(ProjectExplorer::Project *project);

View File

@@ -4,7 +4,7 @@
#include "qmlproject.h"
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtkitaspect.h>
#include <qtsupport/qtsupportconstants.h>
#include <QTimer>
@@ -39,8 +39,10 @@
using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;
namespace QmlProjectManager {
QmlProject::QmlProject(const Utils::FilePath &fileName)
: Project(QString::fromLatin1(Constants::QMLPROJECT_MIMETYPE), fileName)
{
@@ -86,7 +88,7 @@ void QmlProject::parsingFinished(const Target *target, bool success)
openFile(fileToOpen);
}
Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *errorMessage)
Project::RestoreResult QmlProject::fromMap(const Store &map, QString *errorMessage)
{
RestoreResult result = Project::fromMap(map, errorMessage);
if (result != RestoreResult::Ok)
@@ -231,9 +233,9 @@ int QmlProject::preferedQtTarget(Target *target)
bool QmlProject::allowOnlySingleProject()
{
auto settings = Core::ICore::settings();
auto key = "QML/Designer/AllowMultipleProjects";
return !settings->value(QString::fromUtf8(key), false).toBool();
QtcSettings *settings = Core::ICore::settings();
const Key key = "QML/Designer/AllowMultipleProjects";
return !settings->value(key, false).toBool();
}
} // namespace QmlProjectManager

View File

@@ -7,6 +7,8 @@
#include "qmlprojectmanager_global.h"
#include <projectexplorer/project.h>
#include <QPointer>
namespace QmlProjectManager {
class QmlProject;
@@ -23,7 +25,7 @@ public:
ProjectExplorer::Tasks projectIssues(const ProjectExplorer::Kit *k) const final;
protected:
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
RestoreResult fromMap(const Utils::Store &map, QString *errorMessage) override;
private:
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;

View File

@@ -41,6 +41,7 @@
#include <utils/fileutils.h>
#include <utils/fsengine/fileiconprovider.h>
#include <utils/process.h>
#include <utils/qtcsettings.h>
#include <QAction>
#include <QDesktopServices>
@@ -50,6 +51,7 @@
#include <QTimer>
using namespace ProjectExplorer;
using namespace Utils;
namespace QmlProjectManager::Internal {
@@ -131,8 +133,8 @@ void QmlProjectPlugin::openQDS(const Utils::FilePath &fileName)
Utils::FilePath QmlProjectPlugin::qdsInstallationEntry()
{
QSettings *settings = Core::ICore::settings();
const QString qdsInstallationEntry = "QML/Designer/DesignStudioInstallation"; //set in installer
QtcSettings *settings = Core::ICore::settings();
const Key qdsInstallationEntry = "QML/Designer/DesignStudioInstallation"; //set in installer
return Utils::FilePath::fromUserInput(settings->value(qdsInstallationEntry).toString());
}

View File

@@ -16,19 +16,18 @@
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/environmentaspect.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitaspects.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/target.h>
#include <qmldesignerbase/qmldesignerbaseplugin.h>
#include <qmldesignerbase/utils/qmlpuppetpaths.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtkitaspect.h>
#include <qtsupport/qtsupportconstants.h>
#include <utils/algorithm.h>
@@ -36,6 +35,7 @@
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/process.h>
#include <utils/processinterface.h>
#include <utils/winutils.h>
#include <qmljstools/qmljstoolsconstants.h>
@@ -60,26 +60,29 @@ private:
FilePath mainScript() const;
FilePath qmlRuntimeFilePath() const;
void createQtVersionAspect();
void setupQtVersionAspect();
FilePathAspect qmlViewer{this};
ArgumentsAspect arguments{this};
QmlMainFileAspect qmlMainFile{this};
SelectionAspect qtversion{this};
QmlMultiLanguageAspect multiLanguage{this};
EnvironmentAspect environment{this};
X11ForwardingAspect x11Forwarding{this};
FilePathAspect *m_qmlViewerAspect = nullptr;
QmlMainFileAspect *m_qmlMainFileAspect = nullptr;
QmlMultiLanguageAspect *m_multiLanguageAspect = nullptr;
SelectionAspect *m_qtversionAspect = nullptr;
mutable bool usePuppetAsQmlRuntime = false;
};
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
: RunConfiguration(target, id)
{
m_qmlViewerAspect = addAspect<FilePathAspect>();
m_qmlViewerAspect->setLabelText(Tr::tr("Override device QML viewer:"));
m_qmlViewerAspect->setPlaceHolderText(qmlRuntimeFilePath().toUserOutput());
m_qmlViewerAspect->setHistoryCompleter("QmlProjectManager.viewer.history");
m_qmlViewerAspect->setSettingsKey(Constants::QML_VIEWER_KEY);
qmlViewer.setSettingsKey(Constants::QML_VIEWER_KEY);
qmlViewer.setLabelText(Tr::tr("Override device QML viewer:"));
qmlViewer.setPlaceHolderText(qmlRuntimeFilePath().toUserOutput());
qmlViewer.setHistoryCompleter("QmlProjectManager.viewer.history");
auto argumentAspect = addAspect<ArgumentsAspect>(macroExpander());
argumentAspect->setSettingsKey(Constants::QML_VIEWER_ARGUMENTS_KEY);
arguments.setSettingsKey(Constants::QML_VIEWER_ARGUMENTS_KEY);
arguments.setMacroExpander(macroExpander());
setCommandLineGetter([this, target] {
const FilePath qmlRuntime = qmlRuntimeFilePath();
@@ -88,7 +91,7 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
cmd.addArg("--qml-runtime");
// arguments in .user file
cmd.addArgs(aspect<ArgumentsAspect>()->arguments(), CommandLine::Raw);
cmd.addArgs(arguments(), CommandLine::Raw);
// arguments from .qmlproject file
const QmlBuildSystem *bs = qobject_cast<QmlBuildSystem *>(target->buildSystem());
@@ -120,33 +123,31 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
return cmd;
});
m_qmlMainFileAspect = addAspect<QmlMainFileAspect>(target);
connect(m_qmlMainFileAspect, &QmlMainFileAspect::changed, this, &RunConfiguration::update);
qmlMainFile.setTarget(target);
connect(&qmlMainFile, &BaseAspect::changed, this, &RunConfiguration::update);
createQtVersionAspect();
if (Core::ICore::isQtDesignStudio())
setupQtVersionAspect();
else
qtversion.setVisible(false);
connect(target, &Target::kitChanged, this, &RunConfiguration::update);
m_multiLanguageAspect = addAspect<QmlMultiLanguageAspect>(target);
multiLanguage.setTarget(target);
auto buildSystem = qobject_cast<const QmlBuildSystem *>(activeBuildSystem());
if (buildSystem)
m_multiLanguageAspect->setValue(buildSystem->multilanguageSupport());
multiLanguage.setValue(buildSystem->multilanguageSupport());
auto envAspect = addAspect<EnvironmentAspect>();
connect(m_multiLanguageAspect,
&QmlMultiLanguageAspect::changed,
envAspect,
&EnvironmentAspect::environmentChanged);
connect(&multiLanguage, &BaseAspect::changed,
&environment, &EnvironmentAspect::environmentChanged);
auto envModifier = [this](Environment env) {
if (auto bs = qobject_cast<const QmlBuildSystem *>(activeBuildSystem()))
env.modify(bs->environment());
if (m_multiLanguageAspect && m_multiLanguageAspect->value()
&& !m_multiLanguageAspect->databaseFilePath().isEmpty()) {
env.set("QT_MULTILANGUAGE_DATABASE",
m_multiLanguageAspect->databaseFilePath().toString());
env.set("QT_MULTILANGUAGE_LANGUAGE", m_multiLanguageAspect->currentLocale());
if (multiLanguage() && !multiLanguage.databaseFilePath().isEmpty()) {
env.set("QT_MULTILANGUAGE_DATABASE", multiLanguage.databaseFilePath().path());
env.set("QT_MULTILANGUAGE_LANGUAGE", multiLanguage.currentLocale());
} else {
env.unset("QT_MULTILANGUAGE_DATABASE");
env.unset("QT_MULTILANGUAGE_LANGUAGE");
@@ -156,24 +157,21 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
const Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(target->kit());
if (deviceTypeId == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
envAspect->addPreferredBaseEnvironment(Tr::tr("System Environment"), [envModifier] {
environment.addPreferredBaseEnvironment(Tr::tr("System Environment"), [envModifier] {
return envModifier(Environment::systemEnvironment());
});
}
envAspect->addSupportedBaseEnvironment(Tr::tr("Clean Environment"), [envModifier] {
environment.addSupportedBaseEnvironment(Tr::tr("Clean Environment"), [envModifier] {
Environment environment;
return envModifier(environment);
});
if (HostOsInfo::isAnyUnixHost())
addAspect<X11ForwardingAspect>(macroExpander());
x11Forwarding.setMacroExpander(macroExpander());
setRunnableModifier([this](Runnable &r) {
setRunnableModifier([this](ProcessRunData &r) {
const QmlBuildSystem *bs = static_cast<QmlBuildSystem *>(activeBuildSystem());
r.workingDirectory = bs->targetDirectory();
if (const auto * const forwardingAspect = aspect<X11ForwardingAspect>())
r.extraData.insert("Ssh.X11ForwardToDisplay", forwardingAspect->display());
});
setDisplayName(Tr::tr("QML Utility", "QMLRunConfiguration display name."));
@@ -200,9 +198,8 @@ FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const
{
usePuppetAsQmlRuntime = false;
// Give precedence to the manual override in the run configuration.
const FilePath qmlViewer = m_qmlViewerAspect->filePath();
if (!qmlViewer.isEmpty())
return qmlViewer;
if (!qmlViewer().isEmpty())
return qmlViewer();
Kit *kit = target()->kit();
@@ -243,15 +240,14 @@ FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const
return dev ? dev->filePath("qml").searchInPath() : "qml";
}
void QmlProjectRunConfiguration::createQtVersionAspect()
void QmlProjectRunConfiguration::setupQtVersionAspect()
{
if (!Core::ICore::isQtDesignStudio())
return;
m_qtversionAspect = addAspect<SelectionAspect>();
m_qtversionAspect->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
m_qtversionAspect->setLabelText(Tr::tr("Qt Version:"));
m_qtversionAspect->setSettingsKey("QmlProjectManager.kit");
qtversion.setSettingsKey("QmlProjectManager.kit");
qtversion.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
qtversion.setLabelText(Tr::tr("Qt Version:"));
Kit *kit = target()->kit();
QtVersion *version = QtKitAspect::qtVersion(kit);
@@ -261,23 +257,23 @@ void QmlProjectRunConfiguration::createQtVersionAspect()
const bool isQt6Project = buildSystem && buildSystem->qt6Project();
if (isQt6Project) {
m_qtversionAspect->addOption(Tr::tr("Qt 6"));
m_qtversionAspect->setReadOnly(true);
qtversion.addOption(Tr::tr("Qt 6"));
qtversion.setReadOnly(true);
} else { /* Only if this is not a Qt 6 project changing kits makes sense */
m_qtversionAspect->addOption(Tr::tr("Qt 5"));
m_qtversionAspect->addOption(Tr::tr("Qt 6"));
qtversion.addOption(Tr::tr("Qt 5"));
qtversion.addOption(Tr::tr("Qt 6"));
const int valueForVersion = version->qtVersion().majorVersion() == 6 ? 1 : 0;
m_qtversionAspect->setValue(valueForVersion);
qtversion.setValue(valueForVersion);
connect(m_qtversionAspect, &SelectionAspect::changed, this, [&]() {
connect(&qtversion, &BaseAspect::changed, this, [this] {
QTC_ASSERT(target(), return );
auto project = target()->project();
QTC_ASSERT(project, return );
int oldValue = !m_qtversionAspect->value();
const int preferedQtVersion = m_qtversionAspect->value() > 0 ? 6 : 5;
int oldValue = !qtversion();
const int preferedQtVersion = qtversion() > 0 ? 6 : 5;
Kit *currentKit = target()->kit();
const QList<Kit *> kits = Utils::filtered(KitManager::kits(), [&](const Kit *k) {
@@ -298,9 +294,10 @@ void QmlProjectRunConfiguration::createQtVersionAspect()
project->setActiveTarget(newTarget, SetActive::Cascade);
/* Reset the aspect. We changed the target and this aspect should not change. */
m_qtversionAspect->blockSignals(true);
m_qtversionAspect->setValue(oldValue);
m_qtversionAspect->blockSignals(false);
// FIXME: That should use setValueSilently()
qtversion.blockSignals(true);
qtversion.setValue(oldValue);
qtversion.blockSignals(false);
}
});
}
@@ -309,13 +306,14 @@ void QmlProjectRunConfiguration::createQtVersionAspect()
bool QmlProjectRunConfiguration::isEnabled() const
{
return m_qmlMainFileAspect->isQmlFilePresent() && !commandLine().executable().isEmpty()
&& activeBuildSystem()->hasParsingData();
return const_cast<QmlProjectRunConfiguration *>(this)->qmlMainFile.isQmlFilePresent()
&& !commandLine().executable().isEmpty()
&& activeBuildSystem()->hasParsingData();
}
FilePath QmlProjectRunConfiguration::mainScript() const
{
return m_qmlMainFileAspect->mainScript();
return qmlMainFile.mainScript();
}
// QmlProjectRunConfigurationFactory