QSObject QSAEditor::queryQSObject( const QMetaObject *meta, const QString &property, bool /*includeSuperClass*/ ) const { int propertyIndex = -1; const QMetaObject *m = meta; propertyIndex = m->indexOfProperty(property.toLatin1().constData()); if (propertyIndex >= 0) { QMetaProperty mp = m->property(propertyIndex); QSObject o = vTypeToQSType( QString::fromLatin1(mp.typeName()) ); if ( !o.isNull() && !o.isUndefined() ) return o; } m = meta; for (int i=0; i<m->methodCount(); ++i) { QMetaMethod mm = m->method(i); if (mm.methodType() == QMetaMethod::Slot) { QString n = QLatin1String(mm.methodSignature()); n = n.left(n.indexOf('(')); if ( property != n ) continue; return vTypeToQSType(mm.typeName()); } } return env()->createUndefined(); }
QSObject QSAEditor::queryQSObject( const QVector<QObject *> &objects, const QString &property ) const { for ( int i = 0; i < objects.count(); i++ ) { const QMetaObject *mo = objects[i]->metaObject(); QSObject qso = queryQSObject( mo, property, i == 0 ); if ( !qso.isNull() && !qso.isUndefined() ) return qso; } return env()->createUndefined(); }