diff --git a/share/qtcreator/qmldesigner/stateseditor/Main.qml b/share/qtcreator/qmldesigner/stateseditor/Main.qml index 80209864a17..8774f3a02b2 100644 --- a/share/qtcreator/qmldesigner/stateseditor/Main.qml +++ b/share/qtcreator/qmldesigner/stateseditor/Main.qml @@ -412,6 +412,8 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter width: stateGroupLabel.visible ? StudioTheme.Values.defaultControlWidth : root.width - 2 * root.padding + enabled: !(StatesEditorBackend.statesEditorModel.isMCUs + && stateGroupComboBox.count <= 1) HelperWidgets.Tooltip { id: comboBoxTooltip } @@ -420,7 +422,9 @@ Rectangle { running: stateGroupComboBox.hovered onTriggered: comboBoxTooltip.showText(stateGroupComboBox, hoverHandler.point.position, - qsTr("Switch State Group")) + StatesEditorBackend.statesEditorModel.isMCUs + ? qsTr("State Groups are not supported with Qt for MCUs") + : qsTr("Switch State Group")) } onHoverChanged: { @@ -463,8 +467,11 @@ Rectangle { style: StudioTheme.Values.viewBarButtonStyle buttonIcon: StudioTheme.Constants.add_medium anchors.verticalCenter: parent.verticalCenter - tooltip: qsTr("Create State Group") + tooltip: StatesEditorBackend.statesEditorModel.isMCUs + ? qsTr("State Groups are not supported with Qt for MCUs") + : qsTr("Create State Group") onClicked: StatesEditorBackend.statesEditorModel.addStateGroup("stateGroup") + enabled: !StatesEditorBackend.statesEditorModel.isMCUs } HelperWidgets.AbstractButton { diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp index c317374c8da..606e136de01 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp @@ -5,6 +5,7 @@ #include "stateseditorview.h" #include +#include #include #include #include @@ -74,6 +75,7 @@ void StatesEditorModel::reset() evaluateExtend(); emit baseStateChanged(); + emit isMCUsChanged(); } QVariant StatesEditorModel::data(const QModelIndex &index, int role) const @@ -456,4 +458,9 @@ void StatesEditorModel::setCanAddNewStates(bool b) emit canAddNewStatesChanged(); } +bool StatesEditorModel::isMCUs() const +{ + return DesignerMcuManager::instance().isMCUProject(); +} + } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h index 0e228e46bd8..12d66e29bf2 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h @@ -82,6 +82,7 @@ public: Q_PROPERTY(int activeStateGroupIndex READ activeStateGroupIndex WRITE setActiveStateGroupIndex NOTIFY activeStateGroupIndexChanged) Q_PROPERTY(QStringList stateGroups READ stateGroups NOTIFY stateGroupsChanged) + Q_PROPERTY(bool isMCUs READ isMCUs NOTIFY isMCUsChanged) Q_INVOKABLE void move(int from, int to); Q_INVOKABLE void drop(int from, int to); @@ -92,6 +93,8 @@ public: bool canAddNewStates() const; void setCanAddNewStates(bool b); + bool isMCUs() const; + signals: void changedToState(int n); void baseStateChanged(); @@ -101,6 +104,7 @@ signals: void activeStateGroupIndexChanged(); void stateGroupsChanged(); void canAddNewStatesChanged(); + void isMCUsChanged(); private: QPointer m_statesEditorView;