diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index 67f20b8461f..1d9f1eec84f 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -72,7 +72,7 @@ WidgetInfo StatesEditorView::widgetInfo() void StatesEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) { - checkForWindow(); + checkForStatesAvailability(); } void StatesEditorView::toggleStatesViewExpanded() @@ -200,12 +200,10 @@ void StatesEditorView::duplicateCurrentState() setCurrentState(newState); } -void StatesEditorView::checkForWindow() +void StatesEditorView::checkForStatesAvailability() { if (m_statesEditorWidget) - m_statesEditorWidget->showAddNewStatesButton(!rootModelNode().metaInfo().isSubclassOf("QtQuick.Window.Window") - && !rootModelNode().metaInfo().isSubclassOf("QtQuick.Dialogs.Dialog") - && !rootModelNode().metaInfo().isSubclassOf("QtQuick.Window.Popup")); + m_statesEditorWidget->showAddNewStatesButton(rootModelNode().metaInfo().isSubclassOf("QtQuick.Item")); } void StatesEditorView::setCurrentState(const QmlModelState &state) @@ -315,7 +313,7 @@ void StatesEditorView::modelAttached(Model *model) if (m_statesEditorWidget) m_statesEditorWidget->setNodeInstanceView(nodeInstanceView()); - checkForWindow(); + checkForStatesAvailability(); resetModel(); } diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h index 155029ede06..2f8bc566507 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h @@ -93,7 +93,7 @@ private: void resetModel(); void addState(); void duplicateCurrentState(); - void checkForWindow(); + void checkForStatesAvailability(); private: QPointer m_statesEditorModel; diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp index 5ff63f1f1f3..f02ca1ead73 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp @@ -51,13 +51,7 @@ bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode) if (modelNode.metaInfo().isSubclassOf("QtQuick.Item")) return true; - if (modelNode.metaInfo().isSubclassOf("QtQuick.Window.Window") && modelNode.isRootNode()) - return true; - - if (modelNode.metaInfo().isSubclassOf("QtQuick.Dialogs.Dialog") && modelNode.isRootNode()) - return true; - - if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Popup")) + if (modelNode.metaInfo().isGraphicalItem() && modelNode.isRootNode()) return true; return false;