summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-04-27 10:32:45 (GMT)
committerRoberto Raggi <roberto.raggi@nokia.com>2009-04-27 10:32:45 (GMT)
commit1d01ff1e958a632e665084cf6dbf7c6bbaf4f0c5 (patch)
tree2e75dac2926f2f459fa8adc42febe1244c95ba8c /src/declarative/qml
parente793ab29e651a7b07354224a82343d66c265f361 (diff)
parenteae3489b3f2fba9d733ca50eb89dc92a6e96e6f8 (diff)
downloadQt-1d01ff1e958a632e665084cf6dbf7c6bbaf4f0c5.zip
Qt-1d01ff1e958a632e665084cf6dbf7c6bbaf4f0c5.tar.gz
Qt-1d01ff1e958a632e665084cf6dbf7c6bbaf4f0c5.tar.bz2
Merge branch 'kinetic-declarativeui' of git://scm.dev.nokia.troll.no/qt/kinetic into kinetic-declarativeui-qfx
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp31
-rw-r--r--src/declarative/qml/qmlmetaproperty.h8
2 files changed, 37 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 1218b99..e7f7cfb 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -103,7 +103,18 @@ QmlMetaProperty::~QmlMetaProperty()
// ### not thread safe
static QHash<const QMetaObject *, QMetaPropertyEx> qmlCacheDefProp;
+
+/*!
+ Creates a QmlMetaProperty for the default property of \a obj. If there is no
+ default property, an invalid QmlMetaProperty will be created.
+ */
+QmlMetaProperty::QmlMetaProperty(QObject *obj)
+{
+ initDefault(obj);
+}
+
/*!
+ \internal
Creates a QmlMetaProperty for the default property of \a obj. If there is no
default property, an invalid QmlMetaProperty will be created.
*/
@@ -111,6 +122,11 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, QmlContext *ctxt)
: d(new QmlMetaPropertyPrivate)
{
d->context = ctxt;
+ initDefault(obj);
+}
+
+void QmlMetaProperty::initDefault(QObject *obj)
+{
if(!obj)
return;
@@ -162,6 +178,16 @@ static QHash<const QMetaObject *, QHash<QString, QMetaPropertyEx> > qmlCacheProp
/*!
Creates a QmlMetaProperty for the property \a name of \a obj.
*/
+QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name)
+: d(new QmlMetaPropertyPrivate)
+{
+ initProperty(obj, name);
+}
+
+/*!
+ \internal
+ Creates a QmlMetaProperty for the property \a name of \a obj.
+ */
QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name, QmlContext *ctxt)
: d(new QmlMetaPropertyPrivate)
{
@@ -170,6 +196,11 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name, QmlContext *
#endif
d->context = ctxt;
+ initProperty(obj, name);
+}
+
+void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
+{
d->name = name;
d->object = obj;
if(name.isEmpty() || !obj)
diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h
index a2939f9..4836038 100644
--- a/src/declarative/qml/qmlmetaproperty.h
+++ b/src/declarative/qml/qmlmetaproperty.h
@@ -72,8 +72,10 @@ public:
Normal
};
QmlMetaProperty();
- QmlMetaProperty(QObject *, QmlContext * = 0);
- QmlMetaProperty(QObject *, const QString &, QmlContext * = 0);
+ QmlMetaProperty(QObject *);
+ QmlMetaProperty(QObject *, const QString &);
+ QmlMetaProperty(QObject *, QmlContext *);
+ QmlMetaProperty(QObject *, const QString &, QmlContext *);
QmlMetaProperty(const QmlMetaProperty &);
QmlMetaProperty &operator=(const QmlMetaProperty &);
QmlMetaProperty(QObject *, int, PropertyCategory = Unknown, QmlContext * = 0);
@@ -125,6 +127,8 @@ public:
int coreIndex() const;
private:
+ void initDefault(QObject *obj);
+ void initProperty(QObject *obj, const QString &name);
friend class QmlEnginePrivate;
QmlMetaPropertyPrivate *d;
};