Skip to content

Commit

Permalink
Revert "cache the arguments in property cache data"
Browse files Browse the repository at this point in the history
This reverts commit 3032765.
  • Loading branch information
yinyunqiao committed May 25, 2011
1 parent 62fcdaf commit c741910
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
31 changes: 1 addition & 30 deletions src/declarative/qml/qdeclarativepropertycache.cpp
Expand Up @@ -93,26 +93,6 @@ void QDeclarativePropertyCache::Data::load(const QMetaProperty &p, QDeclarativeE
revision = p.revision();
}

int QDeclarativePropertyCache::Data::enumType(const QMetaObject *meta, const QString &strname)
{
QByteArray str = strname.toUtf8();
QByteArray scope;
QByteArray name;
int scopeIdx = str.lastIndexOf("::");
if (scopeIdx != -1) {
scope = str.left(scopeIdx);
name = str.mid(scopeIdx + 2);
} else {
name = str;
}
for (int i = meta->enumeratorCount() - 1; i >= 0; --i) {
QMetaEnum m = meta->enumerator(i);
if ((m.name() == name) && (scope.isEmpty() || (m.scope() == scope)))
return QVariant::Int;
}
return QVariant::Invalid;
}

void QDeclarativePropertyCache::Data::load(const QMetaMethod &m)
{
coreIndex = m.methodIndex();
Expand All @@ -127,17 +107,8 @@ void QDeclarativePropertyCache::Data::load(const QMetaMethod &m)
propType = QMetaType::type(returnType);

QList<QByteArray> params = m.parameterTypes();
if (!params.isEmpty()) {
if (!params.isEmpty())
flags |= Data::HasArguments;
paramTypes.resize(params.size());
for (int i = 0; i < params.size(); ++i) {
paramTypes[i] = QMetaType::type(params.at(i));
if (paramTypes[i] == QVariant::Invalid)
paramTypes[i] = enumType(m.enclosingMetaObject(), QString::fromLatin1(params.at(i)));
if (paramTypes[i] == QVariant::Invalid)
paramTypes[i] = -1; //Unknown method parameter type
}
}
revision = m.revision();
}

Expand Down
5 changes: 2 additions & 3 deletions src/declarative/qml/qdeclarativepropertycache_p.h
Expand Up @@ -64,6 +64,7 @@ QT_BEGIN_NAMESPACE

class QDeclarativeEngine;
class QMetaProperty;

class Q_AUTOTEST_EXPORT QDeclarativePropertyCache : public QDeclarativeRefCount, public QDeclarativeCleanup
{
public:
Expand All @@ -73,7 +74,6 @@ class Q_AUTOTEST_EXPORT QDeclarativePropertyCache : public QDeclarativeRefCount,

struct Data {
inline Data();

inline bool operator==(const Data &);

enum Flag {
Expand Down Expand Up @@ -115,9 +115,8 @@ class Q_AUTOTEST_EXPORT QDeclarativePropertyCache : public QDeclarativeRefCount,
int overrideIndex : 31;
int revision;
int metaObjectOffset;
QVector<int> paramTypes;

static Flags flagsForProperty(const QMetaProperty &, QDeclarativeEngine *engine = 0);
int enumType(const QMetaObject *meta, const QString &strname);
void load(const QMetaProperty &, QDeclarativeEngine *engine = 0);
void load(const QMetaMethod &);
QString name(QObject *);
Expand Down

0 comments on commit c741910

Please sign in to comment.