aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksei German <aleksei.german@qt.io>2023-11-21 14:54:32 +0100
committerAleksei German <aleksei.german@qt.io>2023-11-23 11:05:51 +0000
commit71394691b5ec186ca8eaf019b9b015045721c07d (patch)
treec78b79c9526c638a166e523abfe692413394ba97
parentc14dc9d2baa2b7813be5fd5d02905b0ecd89309c (diff)
QmlDesigner: Fix for MCUs styles combobox
Task-number: QDS-11258 Change-Id: Ib1399e111daf14856e3e679619978180ba7da088 Reviewed-by: Aleksei German <aleksei.german@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/componentcore/changestyleaction.cpp16
-rw-r--r--src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp3
-rw-r--r--src/plugins/qmldesigner/components/toolbar/toolbarbackend.h3
3 files changed, 17 insertions, 5 deletions
diff --git a/src/plugins/qmldesigner/components/componentcore/changestyleaction.cpp b/src/plugins/qmldesigner/components/componentcore/changestyleaction.cpp
index aa38692940..2bf06c1a1a 100644
--- a/src/plugins/qmldesigner/components/componentcore/changestyleaction.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/changestyleaction.cpp
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "changestyleaction.h"
-#include "designermcumanager.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectmanager.h>
@@ -47,6 +46,17 @@ static QString styleConfigFileName(const QString &qmlFileName)
return QString();
}
+static bool isQtForMCUs()
+{
+ if (ProjectExplorer::ProjectManager::startupTarget()) {
+ const QmlProjectManager::QmlBuildSystem *buildSystem = qobject_cast<QmlProjectManager::QmlBuildSystem *>(
+ ProjectExplorer::ProjectManager::startupTarget()->buildSystem());
+ if (buildSystem)
+ return buildSystem->qtForMCUs();
+ }
+ return false;
+}
+
ChangeStyleWidgetAction::ChangeStyleWidgetAction(QObject *parent) : QWidgetAction(parent)
{
items = getAllStyleItems();
@@ -78,7 +88,7 @@ QList<StyleWidgetEntry> ChangeStyleWidgetAction::getAllStyleItems()
if (Utils::HostOsInfo::isWindowsHost())
items.append({"Windows", "Windows", {}});
- if (DesignerMcuManager::instance().isMCUProject())
+ if (isQtForMCUs())
items.append({"MCUDefaultStyle", "MCUDefaultStyle", {}});
//what if we have a custom style set in .conf?
@@ -178,7 +188,7 @@ QWidget *ChangeStyleWidgetAction::createWidget(QWidget *parent)
comboBox->setDisabled(true);
comboBox->setToolTip(tr(disbledTooltip));
comboBox->setCurrentIndex(0);
- } else if (DesignerMcuManager::instance().isMCUProject()) {
+ } else if (isQtForMCUs()) {
comboBox->setDisabled(true);
comboBox->setEditText(style);
} else {
diff --git a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp
index 37f512edb9..6ce8ef193a 100644
--- a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp
+++ b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp
@@ -353,8 +353,9 @@ ToolBarBackend::ToolBarBackend(QObject *parent)
[this](ProjectExplorer::Project *project) {
disconnect(m_kitConnection);
emit isQt6Changed();
- emit isMCUsChanged();
emit projectOpenedChanged();
+ emit stylesChanged();
+ emit isMCUsChanged();
if (project) {
m_kitConnection = connect(project,
&ProjectExplorer::Project::activeTargetChanged,
diff --git a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h
index ce8dd62b52..307704d63a 100644
--- a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h
+++ b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h
@@ -84,7 +84,7 @@ class ToolBarBackend : public QObject
Q_PROPERTY(int documentIndex READ documentIndex NOTIFY documentIndexChanged)
Q_PROPERTY(QString currentWorkspace READ currentWorkspace NOTIFY currentWorkspaceChanged)
Q_PROPERTY(bool lockWorkspace READ lockWorkspace WRITE setLockWorkspace NOTIFY lockWorkspaceChanged)
- Q_PROPERTY(QStringList styles READ styles CONSTANT)
+ Q_PROPERTY(QStringList styles READ styles NOTIFY stylesChanged)
Q_PROPERTY(bool isInDesignMode READ isInDesignMode NOTIFY isInDesignModeChanged)
Q_PROPERTY(bool isInEditMode READ isInEditMode NOTIFY isInEditModeChanged)
Q_PROPERTY(bool isInSessionMode READ isInSessionMode NOTIFY isInSessionModeChanged)
@@ -151,6 +151,7 @@ signals:
void documentIndexChanged();
void currentWorkspaceChanged();
void lockWorkspaceChanged();
+ void stylesChanged();
void isInDesignModeChanged();
void isInEditModeChanged();
void isInSessionModeChanged();