forked from qt-creator/qt-creator
QmlDesigner: Fix states editor none visual items
When using any none visual item as root (e.g. Window) which don't have a state property the support for adding a state on the root item needs to be deactivated otherwise QtDS is crashing. The new states editor was missing that. On the other hand the use of StatesGroup with none visual items is supported. Change-Id: I194913719a13099ce8ac7cde5f78083ef84dc37f Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
ea55e01051
commit
62d86837e9
@@ -863,6 +863,7 @@ Rectangle {
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: addWrapper
|
id: addWrapper
|
||||||
|
visible: canAddNewStates
|
||||||
|
|
||||||
Canvas {
|
Canvas {
|
||||||
id: addCanvas
|
id: addCanvas
|
||||||
|
@@ -105,6 +105,8 @@ void StatesEditorView::setActiveStatesGroupNode(const ModelNode &modelNode)
|
|||||||
m_activeStatesGroupNode = modelNode;
|
m_activeStatesGroupNode = modelNode;
|
||||||
resetModel();
|
resetModel();
|
||||||
|
|
||||||
|
checkForStatesAvailability();
|
||||||
|
|
||||||
emit m_statesEditorModel->activeStateGroupChanged();
|
emit m_statesEditorModel->activeStateGroupChanged();
|
||||||
emit m_statesEditorModel->activeStateGroupIndexChanged();
|
emit m_statesEditorModel->activeStateGroupIndexChanged();
|
||||||
}
|
}
|
||||||
@@ -430,8 +432,10 @@ void StatesEditorView::resetStateGroups()
|
|||||||
void StatesEditorView::checkForStatesAvailability()
|
void StatesEditorView::checkForStatesAvailability()
|
||||||
{
|
{
|
||||||
if (m_statesEditorWidget) {
|
if (m_statesEditorWidget) {
|
||||||
const bool isVisual = QmlVisualNode::isValidQmlVisualNode(activeStatesGroupNode());
|
const bool isVisual = activeStatesGroupNode().metaInfo().isBasedOn(
|
||||||
m_statesEditorWidget->showAddNewStatesButton(isVisual);
|
model()->qtQuickItemMetaInfo(), model()->qtQuick3DNodeMetaInfo());
|
||||||
|
const bool isRoot = activeStatesGroupNode().isRootNode();
|
||||||
|
m_statesEditorWidget->showAddNewStatesButton(isVisual || !isRoot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user