forked from qt-creator/qt-creator
QmlDesigner: Extend ToolBar backend for MCUs
Task-number: QDS-10338 Change-Id: I552cb25b9690a0c5dd202d99e8220453225bcd3b Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -14,7 +14,8 @@ namespace QmlDesigner {
|
||||
|
||||
static QString styleConfigFileName(const QString &qmlFileName)
|
||||
{
|
||||
ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectManager::projectForFile(Utils::FilePath::fromString(qmlFileName));
|
||||
ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectManager::projectForFile(
|
||||
Utils::FilePath::fromString(qmlFileName));
|
||||
|
||||
if (currentProject) {
|
||||
const QList<Utils::FilePath> fileNames = currentProject->files(
|
||||
@@ -58,6 +59,11 @@ QList<StyleWidgetEntry> ChangeStyleWidgetAction::getAllStyleItems()
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
items.append({"Windows", "Windows", {}});
|
||||
|
||||
if (DesignerMcuManager::instance().isMCUProject())
|
||||
items.append({"MCUDefaultStyle", "MCUDefaultStyle", {}});
|
||||
|
||||
//what if we have a custom style set in .conf?
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@@ -155,7 +161,6 @@ QWidget *ChangeStyleWidgetAction::createWidget(QWidget *parent)
|
||||
comboBox->setCurrentIndex(0);
|
||||
} else if (DesignerMcuManager::instance().isMCUProject()) {
|
||||
comboBox->setDisabled(true);
|
||||
//TODO: add tooltip regarding MCU limitations, however we are behind string freeze
|
||||
comboBox->setEditText(style);
|
||||
} else {
|
||||
comboBox->setDisabled(false);
|
||||
|
@@ -353,6 +353,7 @@ ToolBarBackend::ToolBarBackend(QObject *parent)
|
||||
[this](ProjectExplorer::Project *project) {
|
||||
disconnect(m_kitConnection);
|
||||
emit isQt6Changed();
|
||||
emit isMCUsChanged();
|
||||
emit projectOpenedChanged();
|
||||
if (project) {
|
||||
m_kitConnection = connect(project,
|
||||
@@ -701,6 +702,20 @@ bool ToolBarBackend::isQt6() const
|
||||
return isQt6Project;
|
||||
}
|
||||
|
||||
bool ToolBarBackend::isMCUs() const
|
||||
{
|
||||
if (!ProjectExplorer::ProjectManager::startupTarget())
|
||||
return false;
|
||||
|
||||
const QmlProjectManager::QmlBuildSystem *buildSystem = qobject_cast<QmlProjectManager::QmlBuildSystem *>(
|
||||
ProjectExplorer::ProjectManager::startupTarget()->buildSystem());
|
||||
QTC_ASSERT(buildSystem, return false);
|
||||
|
||||
const bool isQtForMCUsProject = buildSystem && buildSystem->qtForMCUs();
|
||||
|
||||
return isQtForMCUsProject;
|
||||
}
|
||||
|
||||
bool ToolBarBackend::projectOpened() const
|
||||
{
|
||||
return ProjectExplorer::ProjectManager::instance()->startupProject();
|
||||
|
@@ -93,6 +93,7 @@ class ToolBarBackend : public QObject
|
||||
Q_PROPERTY(QStringList kits READ kits NOTIFY kitsChanged)
|
||||
Q_PROPERTY(int currentKit READ currentKit NOTIFY currentKitChanged)
|
||||
Q_PROPERTY(bool isQt6 READ isQt6 NOTIFY isQt6Changed)
|
||||
Q_PROPERTY(bool isMCUs READ isMCUs NOTIFY isMCUsChanged)
|
||||
Q_PROPERTY(bool projectOpened READ projectOpened NOTIFY projectOpenedChanged)
|
||||
|
||||
public:
|
||||
@@ -138,6 +139,7 @@ public:
|
||||
int currentKit() const;
|
||||
|
||||
bool isQt6() const;
|
||||
bool isMCUs() const;
|
||||
|
||||
bool projectOpened() const;
|
||||
|
||||
@@ -157,6 +159,7 @@ signals:
|
||||
void kitsChanged();
|
||||
void currentKitChanged();
|
||||
void isQt6Changed();
|
||||
void isMCUsChanged();
|
||||
void projectOpenedChanged();
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user