OSDN Git Service

QmlDesigner.statesEditor: do not add redundant imports
authorThomas Hartmann <Thomas.Hartmann@nokia.com>
Fri, 1 Apr 2011 14:49:57 +0000 (16:49 +0200)
committerThomas Hartmann <Thomas.Hartmann@nokia.com>
Fri, 1 Apr 2011 14:50:24 +0000 (16:50 +0200)
Do not add QtQuick 1.0 import if we already have a QtQuick 1.1
import.

Reviewed-by: Kai Koehne
src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp

index 161013a..e03778e 100644 (file)
@@ -140,7 +140,9 @@ void StatesEditorView::addState()
     }
 
     try {
-        if (rootStateGroup().allStates().count() < 1)
+        if ((rootStateGroup().allStates().count() < 1) && //QtQuick import might be missing
+            (!model()->imports().contains(Import::createLibraryImport("QtQuick", "1.0")) &&
+             !model()->imports().contains(Import::createLibraryImport("QtQuick", "1.1"))))
             model()->changeImports(QList<Import>() << Import::createLibraryImport("QtQuick", "1.0"), QList<Import>());
         ModelNode newState = rootStateGroup().addState(newStateName);
         setCurrentState(newState);