QmlDesigner: Disable State Groups for Qt for MCUs

Task-number: QDS-10355
Change-Id: I1b26b8e5b9ef3ed3176b7d6cd34bc1e27879ce1c
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Aleksei German
2023-11-14 17:57:20 +01:00
parent f199755cfe
commit 5b90cbc29a
3 changed files with 20 additions and 2 deletions

View File

@@ -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 {

View File

@@ -5,6 +5,7 @@
#include "stateseditorview.h"
#include <bindingproperty.h>
#include <designermcumanager.h>
#include <modelnode.h>
#include <modelnodeoperations.h>
#include <nodelistproperty.h>
@@ -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

View File

@@ -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<StatesEditorView> m_statesEditorView;