summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@digia.com>2013-03-27 11:02:04 +0100
committerThomas Hartmann <Thomas.Hartmann@digia.com>2013-04-02 14:32:20 +0200
commitb32b942698f114b34be2237ee23f96886eaa1bb2 (patch)
tree6e3703b0b44776ffebebee4e44f0a93111571849 /src
parentbb1a76c0a475186103d2276667403dfe18d38788 (diff)
downloadqt-creator-b32b942698f114b34be2237ee23f96886eaa1bb2.tar.gz
QmlDesigner.MetaInfo: adding NodeMetaInfo::signalNames()
This allows us to access signal names. Change-Id: I37f15d689fde98c3a0101080cce012efcb555085 Reviewed-by: Marco Bubke <marco.bubke@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodemetainfo.h1
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp49
2 files changed, 50 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h
index 54f86ca67d..c2c4766bb0 100644
--- a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h
+++ b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h
@@ -71,6 +71,7 @@ public:
bool isFileComponent() const;
bool hasProperty(const PropertyName &propertyName) const;
PropertyNameList propertyNames() const;
+ PropertyNameList signalNames() const;
PropertyNameList directPropertyNames() const;
PropertyName defaultPropertyName() const;
bool hasDefaultProperty() const;
diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
index fbfc3fce8d..9a99ea08bd 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
@@ -164,10 +164,19 @@ public:
return true;
}
+ virtual bool processSignal(const QString &name, const Value * /*value*/)
+ {
+ m_signals.append(name.toUtf8());
+ return true;
+ }
+
QList<PropertyInfo> properties() const { return m_properties; }
+ PropertyNameList signalList() const { return m_signals; }
+
private:
QList<PropertyInfo> m_properties;
+ PropertyNameList m_signals;
const ContextPtr m_context;
};
@@ -278,6 +287,32 @@ QList<PropertyInfo> getQmlTypes(const CppComponentValue *objectValue, const Cont
return propertyList;
}
+PropertyNameList getSignals(const ObjectValue *objectValue, const ContextPtr &context, bool local = false)
+{
+ PropertyNameList signalList;
+
+ if (!objectValue)
+ return signalList;
+ if (objectValue->className().isEmpty())
+ return signalList;
+
+ PropertyMemberProcessor processor(context);
+ objectValue->processMembers(&processor);
+
+ signalList.append(processor.signalList());
+
+ if (!local) {
+ const ObjectValue* prototype = objectValue->prototype(context);
+
+ if (prototype == objectValue)
+ return signalList;
+
+ signalList.append(getSignals(prototype, context));
+ }
+
+ return signalList;
+}
+
QList<PropertyInfo> getTypes(const ObjectValue *objectValue, const ContextPtr &context, bool local = false)
{
QList<PropertyInfo> propertyList;
@@ -334,6 +369,7 @@ public:
bool isFileComponent() const;
PropertyNameList properties() const;
PropertyNameList localProperties() const;
+ PropertyNameList signalNames() const;
PropertyName defaultPropertyName() const;
TypeName propertyType(const PropertyName &propertyName) const;
@@ -386,6 +422,7 @@ private:
bool m_isValid;
bool m_isFileComponent;
PropertyNameList m_properties;
+ PropertyNameList m_signals;
QList<TypeName> m_propertyTypes;
PropertyNameList m_localProperties;
PropertyName m_defaultPropertyName;
@@ -418,6 +455,11 @@ PropertyNameList NodeMetaInfoPrivate::localProperties() const
return m_localProperties;
}
+PropertyNameList NodeMetaInfoPrivate::signalNames() const
+{
+ return m_signals;
+}
+
QSet<QString> &NodeMetaInfoPrivate::prototypeCachePositives()
{
return m_prototypeCachePositives;
@@ -484,6 +526,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i
m_defaultPropertyName = objectValue->defaultPropertyName().toUtf8();
m_isValid = true;
setupPrototypes();
+ m_signals = getSignals(objectValue, context());
} else {
const ObjectValue *objectValue = getObjectValue();
if (objectValue) {
@@ -512,6 +555,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i
m_defaultPropertyName = context()->defaultPropertyName(objectValue).toUtf8();
m_isValid = true;
setupPrototypes();
+ m_signals = getSignals(objectValue, context());
}
}
}
@@ -1045,6 +1089,11 @@ PropertyNameList NodeMetaInfo::propertyNames() const
return m_privateData->properties();
}
+PropertyNameList NodeMetaInfo::signalNames() const
+{
+ return m_privateData->signalNames();
+}
+
PropertyNameList NodeMetaInfo::directPropertyNames() const
{
return m_privateData->localProperties();