Add methodIndex function

While not a complete feature, as it does not handle overloads,
it is still an improvement on the current functionality. Would be
a good interim measure until full functionality arrives.

Change-Id: I947adc6a6dbccf676112ac77e186134fb660efd3
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
Alan Alpert
2013-03-29 12:51:48 -07:00
parent b9fd359b6e
commit ccc1952327
2 changed files with 8 additions and 0 deletions

View File

@@ -208,6 +208,13 @@ int FakeMetaObject::methodOffset() const
{ return 0; }
FakeMetaMethod FakeMetaObject::method(int index) const
{ return m_methods.at(index); }
int FakeMetaObject::methodIndex(const QString &name) const //If performances becomes an issue, just use a nameToIdx hash
{
for (int i=0; i<m_methods.count(); i++)
if (m_methods[i].methodName() == name)
return i;
return -1;
}
QString FakeMetaObject::defaultPropertyName() const
{ return m_defaultPropertyName; }

View File

@@ -188,6 +188,7 @@ public:
int methodCount() const;
int methodOffset() const;
FakeMetaMethod method(int index) const;
int methodIndex(const QString &name) const; // Note: Returns any method with that name in case of overloads
QString defaultPropertyName() const;
void setDefaultPropertyName(const QString &defaultPropertyName);