diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-02-23 20:41:53 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-18 11:47:17 +0200 |
commit | 6d3676e877da86d9ec8d4c5094ec19c38a6649e7 (patch) | |
tree | bdcd861841b385f1f28f90404055ed5bf3bd7f02 /src/declarative/qml/qdeclarativeobjectscriptclass.cpp | |
parent | d2e40f5dbd6d1a550bc70a7adb8511788eeca031 (diff) |
Adapt to Qt5 meta-object changes
QMetaMethod::signature() has been renamed to methodSignature(), and
returns a QByteArray, not const char *.
Thew new function QMetaMethod::isValid() should be used to check
whether a method is valid (it's a lot cheaper than calling
signature()).
Also use the new QMetaObject::checkConnectArgs() overload that
takes QMetaMethods, not strings, as arguments.
Further improvements can be made by using the new functions
QMetaMethod::name(), parameterCount() and parameterTypes(), but
that will be done in separate commits.
Change-Id: I3e4cfbdc7799d8bce747ef37f07d0d097370e409
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'src/declarative/qml/qdeclarativeobjectscriptclass.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index c3140f10..5fbcd368 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -605,7 +605,7 @@ QScriptValue QDeclarativeObjectMethodScriptClass::connect(QScriptContext *contex return engine->undefinedValue(); QByteArray signal("2"); - signal.append(data->object->metaObject()->method(data->data.coreIndex).signature()); + signal.append(data->object->metaObject()->method(data->data.coreIndex).methodSignature()); if (context->argumentCount() == 1) { qScriptConnect(data->object, signal.constData(), QScriptValue(), context->argument(0)); @@ -630,7 +630,7 @@ QScriptValue QDeclarativeObjectMethodScriptClass::disconnect(QScriptContext *con return engine->undefinedValue(); QByteArray signal("2"); - signal.append(data->object->metaObject()->method(data->data.coreIndex).signature()); + signal.append(data->object->metaObject()->method(data->data.coreIndex).methodSignature()); if (context->argumentCount() == 1) { qScriptDisconnect(data->object, signal.constData(), QScriptValue(), context->argument(0)); @@ -1067,7 +1067,7 @@ QDeclarativeObjectMethodScriptClass::callOverloaded(MethodData *method, QScriptC QString error = QLatin1String("Unable to determine callable overload. Candidates are:"); QDeclarativePropertyCache::Data *candidate = &method->data; while (candidate) { - error += QLatin1String("\n ") + QString::fromUtf8(method->object->metaObject()->method(candidate->coreIndex).signature()); + error += QLatin1String("\n ") + QString::fromUtf8(method->object->metaObject()->method(candidate->coreIndex).methodSignature()); candidate = relatedMethod(method->object, candidate, dummy); } return Value(ctxt, ctxt->throwError(error)); @@ -1193,7 +1193,7 @@ static inline int QMetaObject_methods(const QMetaObject *metaObject) static QByteArray QMetaMethod_name(const QMetaMethod &m) { - QByteArray sig = m.signature(); + QByteArray sig = m.methodSignature(); int paren = sig.indexOf('('); if (paren == -1) return sig; |