forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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 {
|
||||
|
@@ -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,
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user