summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2009-08-18 07:05:07 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2009-08-18 07:05:07 (GMT)
commit1ab70725f76433a0f601fdfd70abc55bd6228ac3 (patch)
treeb8d6f9c9e787da1720da451e24b987d4d8d8b409 /src
parent0a74f871b21a9b7835fb1a5213bcac22ca1592cc (diff)
downloadQt-1ab70725f76433a0f601fdfd70abc55bd6228ac3.zip
Qt-1ab70725f76433a0f601fdfd70abc55bd6228ac3.tar.gz
Qt-1ab70725f76433a0f601fdfd70abc55bd6228ac3.tar.bz2
Make qml metatype db fully discoverable again
Allow access to all registered types, and also expose the exact version range a type is provided for.
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qmlmetatype.cpp23
-rw-r--r--src/declarative/qml/qmlmetatype.h5
2 files changed, 28 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index 5ebe970..091bd1b 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -190,6 +190,21 @@ QmlType::~QmlType()
delete d;
}
+int QmlType::majorVersion() const
+{
+ return d->m_version_maj;
+}
+
+int QmlType::minMinorVersion() const
+{
+ return d->m_version_min_from;
+}
+
+int QmlType::maxMinorVersion() const
+{
+ return d->m_version_min_to;
+}
+
bool QmlType::availableInVersion(int vmajor, int vminor) const
{
return vmajor == d->m_version_maj && vminor >= d->m_version_min_from && vminor <= d->m_version_min_to;
@@ -879,6 +894,14 @@ QList<QByteArray> QmlMetaType::qmlTypeNames()
return data->nameToType.keys();
}
+QList<QmlType*> QmlMetaType::qmlTypes()
+{
+ QReadLocker lock(metaTypeDataLock());
+ QmlMetaTypeData *data = metaTypeData();
+
+ return data->nameToType.values();
+}
+
/*!
Copies \a copy into \a data, assuming they both are of type \a type. If
\a copy is zero, a default type is copied. Returns true if the copy was
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index 94029ce..c388b1a 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -65,6 +65,7 @@ public:
static bool copy(int type, void *data, const void *copy = 0);
static QList<QByteArray> qmlTypeNames();
+ static QList<QmlType*> qmlTypes();
static QmlType *qmlType(const QByteArray &, int, int);
static QmlType *qmlType(const QMetaObject *);
@@ -111,6 +112,10 @@ class Q_DECLARATIVE_EXPORT QmlType
public:
QByteArray typeName() const;
QByteArray qmlTypeName() const;
+
+ int majorVersion() const;
+ int minMinorVersion() const;
+ int maxMinorVersion() const;
bool availableInVersion(int vmajor, int vminor) const;
QByteArray hash() const;