aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-10-15 15:44:24 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-10-16 08:35:29 +0200
commit6b20e0e08ed48982e849dbbf9fc53113a491f5e4 (patch)
tree92b490abef19f4cd66391a2941c4136694d06158 /src
parent22e0701ee8baaf20a996abc3773e391687cbad70 (diff)
QQmlJSScope: Add a way to retrieve a single method or property
Change-Id: Icf8f2aae869176ed864dcdd3b4231e71043cb0bc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qmlcompiler/qqmljsmetatypes_p.h11
-rw-r--r--src/qmlcompiler/qqmljsscope_p.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/src/qmlcompiler/qqmljsmetatypes_p.h b/src/qmlcompiler/qqmljsmetatypes_p.h
index 8d63c7151a..89fdd7cd1b 100644
--- a/src/qmlcompiler/qqmljsmetatypes_p.h
+++ b/src/qmlcompiler/qqmljsmetatypes_p.h
@@ -167,13 +167,14 @@ class QQmlJSMetaProperty
QString m_propertyName;
QString m_typeName;
QWeakPointer<const QQmlJSScope> m_type;
- bool m_isList;
- bool m_isWritable;
- bool m_isPointer;
- bool m_isAlias;
- int m_revision;
+ bool m_isList = false;
+ bool m_isWritable = false;
+ bool m_isPointer = false;
+ bool m_isAlias = false;
+ int m_revision = 0;
public:
+ QQmlJSMetaProperty() = default;
QQmlJSMetaProperty(QString propertyName, QString typeName,
bool isList, bool isWritable, bool isPointer, bool isAlias,
int revision)
diff --git a/src/qmlcompiler/qqmljsscope_p.h b/src/qmlcompiler/qqmljsscope_p.h
index 90696166e4..619fa09bd6 100644
--- a/src/qmlcompiler/qqmljsscope_p.h
+++ b/src/qmlcompiler/qqmljsscope_p.h
@@ -166,6 +166,7 @@ public:
void addMethods(const QMultiHash<QString, QQmlJSMetaMethod> &methods) { m_methods.unite(methods); }
void addMethod(const QQmlJSMetaMethod &method) { m_methods.insert(method.methodName(), method); }
QMultiHash<QString, QQmlJSMetaMethod> methods() const { return m_methods; }
+ QQmlJSMetaMethod method(const QString &name) const { return m_methods.value(name); }
void addEnum(const QQmlJSMetaEnum &fakeEnum) { m_enums.insert(fakeEnum.name(), fakeEnum); }
QHash<QString, QQmlJSMetaEnum> enums() const { return m_enums; }
@@ -190,6 +191,7 @@ public:
void addProperty(const QQmlJSMetaProperty &prop) { m_properties.insert(prop.propertyName(), prop); }
QHash<QString, QQmlJSMetaProperty> properties() const { return m_properties; }
+ QQmlJSMetaProperty property(const QString &name) const { return m_properties.value(name); }
QString defaultPropertyName() const { return m_defaultPropertyName; }
void setDefaultPropertyName(const QString &name) { m_defaultPropertyName = name; }