From 4a7cf0c630550b1611a5fb76b888dd41516c4af4 Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@digia.com>
Date: Mon, 14 Apr 2014 17:34:53 +0200
Subject: [PATCH] QmlDesigner.StatesEditor: Do not allow adding states to
 Window

We only checked for ApplicationWindow. Instead of ApplicationWindow
we have to check for Window. ApplicationWindow is derived from Window.

Change-Id: I5d287af4284e31dcd77e06b498c5ae61dc348ad6
Reviewed-by: Marco Bubke <marco.bubke@digia.com>
---
 .../components/stateseditor/stateseditorview.cpp          | 8 ++++----
 .../components/stateseditor/stateseditorview.h            | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
index b314dabd65f..875f27bb73d 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
@@ -83,7 +83,7 @@ void StatesEditorView::propertiesAboutToBeRemoved(const QList<AbstractProperty>
 
 void StatesEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
 {
-    checkForApplicationWindow();
+    checkForWindow();
 }
 
 void StatesEditorView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/)
@@ -249,10 +249,10 @@ void StatesEditorView::duplicateCurrentState()
     setCurrentState(newState);
 }
 
-void StatesEditorView::checkForApplicationWindow()
+void StatesEditorView::checkForWindow()
 {
     if (m_statesEditorWidget)
-        m_statesEditorWidget->showAddNewStatesButton(!rootModelNode().metaInfo().isSubclassOf("QtQuick.Controls.ApplicationWindow", -1, -1));
+        m_statesEditorWidget->showAddNewStatesButton(!rootModelNode().metaInfo().isSubclassOf("QtQuick.Window.Window", -1, -1));
 }
 
 void StatesEditorView::setCurrentState(const QmlModelState &state)
@@ -320,7 +320,7 @@ void StatesEditorView::modelAttached(Model *model)
     if (m_statesEditorWidget)
         m_statesEditorWidget->setNodeInstanceView(nodeInstanceView());
 
-    checkForApplicationWindow();
+    checkForWindow();
 
     resetModel();
 }
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
index 70b32e32229..c9656aa0ba1 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
@@ -113,7 +113,7 @@ private:
     void resetModel();
     void addState();
     void duplicateCurrentState();
-    void checkForApplicationWindow();
+    void checkForWindow();
 
 private:
     QWeakPointer<StatesEditorModel> m_statesEditorModel;
-- 
GitLab