OSDN Git Service

QmlDesigner.MetaInfo: Don't put unkown objects in the superclass stack
authorMarco Bubke <marco.bubke@nokia.com>
Tue, 1 Feb 2011 17:36:00 +0000 (18:36 +0100)
committerMarco Bubke <marco.bubke@nokia.com>
Tue, 1 Feb 2011 17:36:00 +0000 (18:36 +0100)
src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp

index 888c538..6be92be 100644 (file)
@@ -128,6 +128,37 @@ private:
     QList<PropertyInfo> m_properties;
 };
 
+
+class HasValueProcessor : public Interpreter::MemberProcessor
+{
+public:
+    HasValueProcessor(const Interpreter::Value *compareValue)
+        : MemberProcessor(),
+          m_compareValue(compareValue),
+          m_isInMembers(false)
+    {}
+
+    virtual bool processProperty(const QString &/*name*/, const Interpreter::Value *value)
+    {
+        if (value == m_compareValue) {
+            m_isInMembers = true;
+            return false;
+        }
+
+        return true;
+    }
+
+    bool hasValue() const
+    {
+        return m_isInMembers;
+    }
+
+private:
+    const Interpreter::Value *m_compareValue;
+    bool m_isInMembers;
+};
+
+
 static inline bool isValueType(const QString &type)
 {
     QStringList objectValuesList;
@@ -792,9 +823,12 @@ void NodeMetaInfoPrivate::setupPrototypes()
             description.majorVersion = qmlValue->version().majorVersion();
             if (!qmlValue->packageName().isEmpty())
                 description.className = qmlValue->packageName() + "/" + description.className;
+        }
 
+        HasValueProcessor hasValueProcessor(ov);
+        lookupContext()->context()->typeEnvironment(document())->processMembers(&hasValueProcessor);
+        if (hasValueProcessor.hasValue())
             m_prototypes.append(description);
-        }
     }
 }