forked from qt-creator/qt-creator
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:
@@ -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; }
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user