forked from qt-creator/qt-creator
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:
@@ -412,6 +412,8 @@ Rectangle {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: stateGroupLabel.visible ? StudioTheme.Values.defaultControlWidth
|
width: stateGroupLabel.visible ? StudioTheme.Values.defaultControlWidth
|
||||||
: root.width - 2 * root.padding
|
: root.width - 2 * root.padding
|
||||||
|
enabled: !(StatesEditorBackend.statesEditorModel.isMCUs
|
||||||
|
&& stateGroupComboBox.count <= 1)
|
||||||
|
|
||||||
HelperWidgets.Tooltip { id: comboBoxTooltip }
|
HelperWidgets.Tooltip { id: comboBoxTooltip }
|
||||||
|
|
||||||
@@ -420,7 +422,9 @@ Rectangle {
|
|||||||
running: stateGroupComboBox.hovered
|
running: stateGroupComboBox.hovered
|
||||||
onTriggered: comboBoxTooltip.showText(stateGroupComboBox,
|
onTriggered: comboBoxTooltip.showText(stateGroupComboBox,
|
||||||
hoverHandler.point.position,
|
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: {
|
onHoverChanged: {
|
||||||
@@ -463,8 +467,11 @@ Rectangle {
|
|||||||
style: StudioTheme.Values.viewBarButtonStyle
|
style: StudioTheme.Values.viewBarButtonStyle
|
||||||
buttonIcon: StudioTheme.Constants.add_medium
|
buttonIcon: StudioTheme.Constants.add_medium
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
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")
|
onClicked: StatesEditorBackend.statesEditorModel.addStateGroup("stateGroup")
|
||||||
|
enabled: !StatesEditorBackend.statesEditorModel.isMCUs
|
||||||
}
|
}
|
||||||
|
|
||||||
HelperWidgets.AbstractButton {
|
HelperWidgets.AbstractButton {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "stateseditorview.h"
|
#include "stateseditorview.h"
|
||||||
|
|
||||||
#include <bindingproperty.h>
|
#include <bindingproperty.h>
|
||||||
|
#include <designermcumanager.h>
|
||||||
#include <modelnode.h>
|
#include <modelnode.h>
|
||||||
#include <modelnodeoperations.h>
|
#include <modelnodeoperations.h>
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
@@ -74,6 +75,7 @@ void StatesEditorModel::reset()
|
|||||||
|
|
||||||
evaluateExtend();
|
evaluateExtend();
|
||||||
emit baseStateChanged();
|
emit baseStateChanged();
|
||||||
|
emit isMCUsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant StatesEditorModel::data(const QModelIndex &index, int role) const
|
QVariant StatesEditorModel::data(const QModelIndex &index, int role) const
|
||||||
@@ -456,4 +458,9 @@ void StatesEditorModel::setCanAddNewStates(bool b)
|
|||||||
emit canAddNewStatesChanged();
|
emit canAddNewStatesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StatesEditorModel::isMCUs() const
|
||||||
|
{
|
||||||
|
return DesignerMcuManager::instance().isMCUProject();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public:
|
|||||||
Q_PROPERTY(int activeStateGroupIndex READ activeStateGroupIndex WRITE setActiveStateGroupIndex
|
Q_PROPERTY(int activeStateGroupIndex READ activeStateGroupIndex WRITE setActiveStateGroupIndex
|
||||||
NOTIFY activeStateGroupIndexChanged)
|
NOTIFY activeStateGroupIndexChanged)
|
||||||
Q_PROPERTY(QStringList stateGroups READ stateGroups NOTIFY stateGroupsChanged)
|
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 move(int from, int to);
|
||||||
Q_INVOKABLE void drop(int from, int to);
|
Q_INVOKABLE void drop(int from, int to);
|
||||||
@@ -92,6 +93,8 @@ public:
|
|||||||
bool canAddNewStates() const;
|
bool canAddNewStates() const;
|
||||||
void setCanAddNewStates(bool b);
|
void setCanAddNewStates(bool b);
|
||||||
|
|
||||||
|
bool isMCUs() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changedToState(int n);
|
void changedToState(int n);
|
||||||
void baseStateChanged();
|
void baseStateChanged();
|
||||||
@@ -101,6 +104,7 @@ signals:
|
|||||||
void activeStateGroupIndexChanged();
|
void activeStateGroupIndexChanged();
|
||||||
void stateGroupsChanged();
|
void stateGroupsChanged();
|
||||||
void canAddNewStatesChanged();
|
void canAddNewStatesChanged();
|
||||||
|
void isMCUsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<StatesEditorView> m_statesEditorView;
|
QPointer<StatesEditorView> m_statesEditorView;
|
||||||
|
|||||||
Reference in New Issue
Block a user