summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-30 16:27:28 +1000
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-31 12:00:42 +1000
commitb30a25280556599177b217f0e8ed3fbe4b11705d (patch)
tree2f32cd0c73f9c8a8f560b754459235546f0dd01d /src/corelib
parent45c11a97a32170d0c6ab9265a102cc8d94fa63ee (diff)
downloadqt4-tools-b30a25280556599177b217f0e8ed3fbe4b11705d.tar.gz
Add index methods to QMetaProperty and QMetaMethod
Authored-by: Kent Hansen Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qmetaobject.cpp20
-rw-r--r--src/corelib/kernel/qmetaobject.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 3b09061b91..611eff3ba7 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1329,6 +1329,16 @@ int QMetaMethod::attributes() const
}
/*!
+ Returns this method's index.
+*/
+int QMetaMethod::methodIndex() const
+{
+ if (!mobj)
+ return -1;
+ return ((handle - priv(mobj->d.data)->methodData) / 5) + mobj->methodOffset();
+}
+
+/*!
Returns the access specification of this method (private,
protected, or public).
@@ -2043,6 +2053,16 @@ int QMetaProperty::userType() const
}
/*!
+ Returns this property's index.
+*/
+int QMetaProperty::propertyIndex() const
+{
+ if (!mobj)
+ return -1;
+ return idx + mobj->propertyOffset();
+}
+
+/*!
Returns true if the property's type is an enumeration value that
is used as a flag; otherwise returns false.
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index bd47582e0e..9f3610654a 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -69,6 +69,7 @@ public:
MethodType methodType() const;
enum Attributes { Compatibility = 0x1, Cloned = 0x2, Scriptable = 0x4 };
int attributes() const;
+ int methodIndex() const;
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
@@ -178,6 +179,7 @@ public:
const char *typeName() const;
QVariant::Type type() const;
int userType() const;
+ int propertyIndex() const;
bool isReadable() const;
bool isWritable() const;