Rename QMetaMethod::signature() to methodSignature()
In Qt5 the meta-data format will be changed to not store the method signature string explicitly; the signature will be reconstructed on demand from the method name and parameter type information. The QMetaMethod::signature() method returns a const char pointer. Changing the return type to QByteArray can lead to silent bugs due to the implicit conversion to char *. Even though it's a source- incompatible change, it's therefore better to introduce a new function, methodSignature(), and remove the old signature(). Task-number: QTBUG-24154 Change-Id: Ib3579dedd27a3c7c8914d5f1b231947be2cf4027 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
This commit is contained in:
parent
3f7a222414
commit
96f2365cf4
5
dist/changes-5.0.0
vendored
5
dist/changes-5.0.0
vendored
@ -56,6 +56,11 @@ information about a particular change.
|
|||||||
* QMetaType::construct() has been renamed to QMetaType::create().
|
* QMetaType::construct() has been renamed to QMetaType::create().
|
||||||
* QMetaType::unregisterType() has been removed.
|
* QMetaType::unregisterType() has been removed.
|
||||||
|
|
||||||
|
- QMetaMethod::signature() has been renamed to QMetaMethod::methodSignature(),
|
||||||
|
and the return type has been changed to QByteArray. This was done to be able
|
||||||
|
to generate the signature string on demand, rather than always storing it in
|
||||||
|
the meta-data.
|
||||||
|
|
||||||
- QTestLib:
|
- QTestLib:
|
||||||
* The plain-text, xml and lightxml test output formats have been changed to
|
* The plain-text, xml and lightxml test output formats have been changed to
|
||||||
show a test result for every row of test data in data-driven tests. In
|
show a test result for every row of test data in data-driven tests. In
|
||||||
|
@ -107,7 +107,7 @@ for(int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); ++i)
|
|||||||
const QMetaObject* metaObject = obj->metaObject();
|
const QMetaObject* metaObject = obj->metaObject();
|
||||||
QStringList methods;
|
QStringList methods;
|
||||||
for(int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i)
|
for(int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i)
|
||||||
methods << QString::fromLatin1(metaObject->method(i).signature());
|
methods << QString::fromLatin1(metaObject->method(i).methodSignature());
|
||||||
//! [methodCount]
|
//! [methodCount]
|
||||||
|
|
||||||
//! [6]
|
//! [6]
|
||||||
|
@ -157,6 +157,11 @@ static inline const QByteArrayData &stringData(const QMetaObject *mo, int index)
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline QByteArray toByteArray(const QByteArrayData &d)
|
||||||
|
{
|
||||||
|
return QByteArray(reinterpret_cast<const QStaticByteArrayData<0> &>(d));
|
||||||
|
}
|
||||||
|
|
||||||
static inline const char *legacyString(const QMetaObject *mo, int index)
|
static inline const char *legacyString(const QMetaObject *mo, int index)
|
||||||
{
|
{
|
||||||
Q_ASSERT(priv(mo->d.data)->revision <= 6);
|
Q_ASSERT(priv(mo->d.data)->revision <= 6);
|
||||||
@ -1268,7 +1273,7 @@ bool QMetaObject::invokeMethod(QObject *obj,
|
|||||||
|
|
||||||
\ingroup objectmodel
|
\ingroup objectmodel
|
||||||
|
|
||||||
A QMetaMethod has a methodType(), a signature(), a list of
|
A QMetaMethod has a methodType(), a methodSignature(), a list of
|
||||||
parameterTypes() and parameterNames(), a return typeName(), a
|
parameterTypes() and parameterNames(), a return typeName(), a
|
||||||
tag(), and an access() specifier. You can use invoke() to invoke
|
tag(), and an access() specifier. You can use invoke() to invoke
|
||||||
the method on an arbitrary QObject.
|
the method on an arbitrary QObject.
|
||||||
@ -1314,22 +1319,24 @@ bool QMetaObject::invokeMethod(QObject *obj,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\since 5.0
|
||||||
|
|
||||||
Returns the signature of this method (e.g.,
|
Returns the signature of this method (e.g.,
|
||||||
\c{setValue(double)}).
|
\c{setValue(double)}).
|
||||||
|
|
||||||
\sa parameterTypes(), parameterNames()
|
\sa parameterTypes(), parameterNames()
|
||||||
*/
|
*/
|
||||||
const char *QMetaMethod::signature() const
|
QByteArray QMetaMethod::methodSignature() const
|
||||||
{
|
{
|
||||||
if (!mobj)
|
if (!mobj)
|
||||||
return 0;
|
return QByteArray();
|
||||||
return rawStringData(mobj, mobj->d.data[handle]);
|
return toByteArray(stringData(mobj, mobj->d.data[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a list of parameter types.
|
Returns a list of parameter types.
|
||||||
|
|
||||||
\sa parameterNames(), signature()
|
\sa parameterNames(), methodSignature()
|
||||||
*/
|
*/
|
||||||
QList<QByteArray> QMetaMethod::parameterTypes() const
|
QList<QByteArray> QMetaMethod::parameterTypes() const
|
||||||
{
|
{
|
||||||
@ -1342,7 +1349,7 @@ QList<QByteArray> QMetaMethod::parameterTypes() const
|
|||||||
/*!
|
/*!
|
||||||
Returns a list of parameter names.
|
Returns a list of parameter names.
|
||||||
|
|
||||||
\sa parameterTypes(), signature()
|
\sa parameterTypes(), methodSignature()
|
||||||
*/
|
*/
|
||||||
QList<QByteArray> QMetaMethod::parameterNames() const
|
QList<QByteArray> QMetaMethod::parameterNames() const
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ class Q_CORE_EXPORT QMetaMethod
|
|||||||
public:
|
public:
|
||||||
inline QMetaMethod() : mobj(0),handle(0) {}
|
inline QMetaMethod() : mobj(0),handle(0) {}
|
||||||
|
|
||||||
const char *signature() const;
|
QByteArray methodSignature() const;
|
||||||
const char *typeName() const;
|
const char *typeName() const;
|
||||||
QList<QByteArray> parameterTypes() const;
|
QList<QByteArray> parameterTypes() const;
|
||||||
QList<QByteArray> parameterNames() const;
|
QList<QByteArray> parameterNames() const;
|
||||||
@ -137,6 +137,13 @@ public:
|
|||||||
inline bool isValid() const { return mobj != 0; }
|
inline bool isValid() const { return mobj != 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if QT_DEPRECATED_SINCE(5,0)
|
||||||
|
// signature() has been renamed to methodSignature() in Qt 5.
|
||||||
|
// Warning, that function returns a QByteArray; check the life time if
|
||||||
|
// you convert to char*.
|
||||||
|
char *signature(struct renamedInQt5_warning_checkTheLifeTime * = 0) Q_DECL_EQ_DELETE;
|
||||||
|
#endif
|
||||||
|
|
||||||
const QMetaObject *mobj;
|
const QMetaObject *mobj;
|
||||||
uint handle;
|
uint handle;
|
||||||
friend struct QMetaObject;
|
friend struct QMetaObject;
|
||||||
|
@ -458,13 +458,13 @@ QMetaMethodBuilder QMetaObjectBuilder::addMethod(const QMetaMethod& prototype)
|
|||||||
{
|
{
|
||||||
QMetaMethodBuilder method;
|
QMetaMethodBuilder method;
|
||||||
if (prototype.methodType() == QMetaMethod::Method)
|
if (prototype.methodType() == QMetaMethod::Method)
|
||||||
method = addMethod(prototype.signature());
|
method = addMethod(prototype.methodSignature());
|
||||||
else if (prototype.methodType() == QMetaMethod::Signal)
|
else if (prototype.methodType() == QMetaMethod::Signal)
|
||||||
method = addSignal(prototype.signature());
|
method = addSignal(prototype.methodSignature());
|
||||||
else if (prototype.methodType() == QMetaMethod::Slot)
|
else if (prototype.methodType() == QMetaMethod::Slot)
|
||||||
method = addSlot(prototype.signature());
|
method = addSlot(prototype.methodSignature());
|
||||||
else if (prototype.methodType() == QMetaMethod::Constructor)
|
else if (prototype.methodType() == QMetaMethod::Constructor)
|
||||||
method = addConstructor(prototype.signature());
|
method = addConstructor(prototype.methodSignature());
|
||||||
method.setReturnType(prototype.typeName());
|
method.setReturnType(prototype.typeName());
|
||||||
method.setParameterNames(prototype.parameterNames());
|
method.setParameterNames(prototype.parameterNames());
|
||||||
method.setTag(prototype.tag());
|
method.setTag(prototype.tag());
|
||||||
@ -535,7 +535,7 @@ QMetaMethodBuilder QMetaObjectBuilder::addConstructor(const QByteArray& signatur
|
|||||||
QMetaMethodBuilder QMetaObjectBuilder::addConstructor(const QMetaMethod& prototype)
|
QMetaMethodBuilder QMetaObjectBuilder::addConstructor(const QMetaMethod& prototype)
|
||||||
{
|
{
|
||||||
Q_ASSERT(prototype.methodType() == QMetaMethod::Constructor);
|
Q_ASSERT(prototype.methodType() == QMetaMethod::Constructor);
|
||||||
QMetaMethodBuilder ctor = addConstructor(prototype.signature());
|
QMetaMethodBuilder ctor = addConstructor(prototype.methodSignature());
|
||||||
ctor.setReturnType(prototype.typeName());
|
ctor.setReturnType(prototype.typeName());
|
||||||
ctor.setParameterNames(prototype.parameterNames());
|
ctor.setParameterNames(prototype.parameterNames());
|
||||||
ctor.setTag(prototype.tag());
|
ctor.setTag(prototype.tag());
|
||||||
@ -588,7 +588,7 @@ QMetaPropertyBuilder QMetaObjectBuilder::addProperty(const QMetaProperty& protot
|
|||||||
if (prototype.hasNotifySignal()) {
|
if (prototype.hasNotifySignal()) {
|
||||||
// Find an existing method for the notify signal, or add a new one.
|
// Find an existing method for the notify signal, or add a new one.
|
||||||
QMetaMethod method = prototype.notifySignal();
|
QMetaMethod method = prototype.notifySignal();
|
||||||
int index = indexOfMethod(method.signature());
|
int index = indexOfMethod(method.methodSignature());
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
index = addMethod(method).index();
|
index = addMethod(method).index();
|
||||||
d->properties[property._index].notifySignal = index;
|
d->properties[property._index].notifySignal = index;
|
||||||
|
@ -2174,12 +2174,12 @@ static inline void check_and_warn_compat(const QMetaObject *sender, const QMetaM
|
|||||||
if (signal.attributes() & QMetaMethod::Compatibility) {
|
if (signal.attributes() & QMetaMethod::Compatibility) {
|
||||||
if (!(method.attributes() & QMetaMethod::Compatibility))
|
if (!(method.attributes() & QMetaMethod::Compatibility))
|
||||||
qWarning("QObject::connect: Connecting from COMPAT signal (%s::%s)",
|
qWarning("QObject::connect: Connecting from COMPAT signal (%s::%s)",
|
||||||
sender->className(), signal.signature());
|
sender->className(), signal.methodSignature().constData());
|
||||||
} else if ((method.attributes() & QMetaMethod::Compatibility) &&
|
} else if ((method.attributes() & QMetaMethod::Compatibility) &&
|
||||||
method.methodType() == QMetaMethod::Signal) {
|
method.methodType() == QMetaMethod::Signal) {
|
||||||
qWarning("QObject::connect: Connecting from %s::%s to COMPAT slot (%s::%s)",
|
qWarning("QObject::connect: Connecting from %s::%s to COMPAT slot (%s::%s)",
|
||||||
sender->className(), signal.signature(),
|
sender->className(), signal.methodSignature().constData(),
|
||||||
receiver->className(), method.signature());
|
receiver->className(), method.methodSignature().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2419,17 +2419,17 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
|
|||||||
|| method.methodType() == QMetaMethod::Constructor) {
|
|| method.methodType() == QMetaMethod::Constructor) {
|
||||||
qWarning("QObject::connect: Cannot connect %s::%s to %s::%s",
|
qWarning("QObject::connect: Cannot connect %s::%s to %s::%s",
|
||||||
sender ? sender->metaObject()->className() : "(null)",
|
sender ? sender->metaObject()->className() : "(null)",
|
||||||
signal.signature(),
|
signal.methodSignature().constData(),
|
||||||
receiver ? receiver->metaObject()->className() : "(null)",
|
receiver ? receiver->metaObject()->className() : "(null)",
|
||||||
method.signature() );
|
method.methodSignature().constData() );
|
||||||
return QMetaObject::Connection(0);
|
return QMetaObject::Connection(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconstructing SIGNAL() macro result for signal.signature() string
|
// Reconstructing SIGNAL() macro result for signal.methodSignature() string
|
||||||
QByteArray signalSignature;
|
QByteArray signalSignature;
|
||||||
signalSignature.reserve(qstrlen(signal.signature())+1);
|
signalSignature.reserve(signal.methodSignature().size()+1);
|
||||||
signalSignature.append((char)(QSIGNAL_CODE + '0'));
|
signalSignature.append((char)(QSIGNAL_CODE + '0'));
|
||||||
signalSignature.append(signal.signature());
|
signalSignature.append(signal.methodSignature());
|
||||||
|
|
||||||
int signal_index;
|
int signal_index;
|
||||||
int method_index;
|
int method_index;
|
||||||
@ -2443,20 +2443,20 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
|
|||||||
const QMetaObject *rmeta = receiver->metaObject();
|
const QMetaObject *rmeta = receiver->metaObject();
|
||||||
if (signal_index == -1) {
|
if (signal_index == -1) {
|
||||||
qWarning("QObject::connect: Can't find signal %s on instance of class %s",
|
qWarning("QObject::connect: Can't find signal %s on instance of class %s",
|
||||||
signal.signature(), smeta->className());
|
signal.methodSignature().constData(), smeta->className());
|
||||||
return QMetaObject::Connection(0);
|
return QMetaObject::Connection(0);
|
||||||
}
|
}
|
||||||
if (method_index == -1) {
|
if (method_index == -1) {
|
||||||
qWarning("QObject::connect: Can't find method %s on instance of class %s",
|
qWarning("QObject::connect: Can't find method %s on instance of class %s",
|
||||||
method.signature(), rmeta->className());
|
method.methodSignature().constData(), rmeta->className());
|
||||||
return QMetaObject::Connection(0);
|
return QMetaObject::Connection(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QMetaObject::checkConnectArgs(signal.signature(), method.signature())) {
|
if (!QMetaObject::checkConnectArgs(signal.methodSignature().constData(), method.methodSignature().constData())) {
|
||||||
qWarning("QObject::connect: Incompatible sender/receiver arguments"
|
qWarning("QObject::connect: Incompatible sender/receiver arguments"
|
||||||
"\n %s::%s --> %s::%s",
|
"\n %s::%s --> %s::%s",
|
||||||
smeta->className(), signal.signature(),
|
smeta->className(), signal.methodSignature().constData(),
|
||||||
rmeta->className(), method.signature());
|
rmeta->className(), method.methodSignature().constData());
|
||||||
return QMetaObject::Connection(0);
|
return QMetaObject::Connection(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2688,24 +2688,24 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
|
|||||||
if(signal.methodType() != QMetaMethod::Signal) {
|
if(signal.methodType() != QMetaMethod::Signal) {
|
||||||
qWarning("QObject::%s: Attempt to %s non-signal %s::%s",
|
qWarning("QObject::%s: Attempt to %s non-signal %s::%s",
|
||||||
"disconnect","unbind",
|
"disconnect","unbind",
|
||||||
sender->metaObject()->className(), signal.signature());
|
sender->metaObject()->className(), signal.methodSignature().constData());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (method.mobj) {
|
if (method.mobj) {
|
||||||
if(method.methodType() == QMetaMethod::Constructor) {
|
if(method.methodType() == QMetaMethod::Constructor) {
|
||||||
qWarning("QObject::disconect: cannot use constructor as argument %s::%s",
|
qWarning("QObject::disconect: cannot use constructor as argument %s::%s",
|
||||||
receiver->metaObject()->className(), method.signature());
|
receiver->metaObject()->className(), method.methodSignature().constData());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconstructing SIGNAL() macro result for signal.signature() string
|
// Reconstructing SIGNAL() macro result for signal.methodSignature() string
|
||||||
QByteArray signalSignature;
|
QByteArray signalSignature;
|
||||||
if (signal.mobj) {
|
if (signal.mobj) {
|
||||||
signalSignature.reserve(qstrlen(signal.signature())+1);
|
signalSignature.reserve(signal.methodSignature().size()+1);
|
||||||
signalSignature.append((char)(QSIGNAL_CODE + '0'));
|
signalSignature.append((char)(QSIGNAL_CODE + '0'));
|
||||||
signalSignature.append(signal.signature());
|
signalSignature.append(signal.methodSignature());
|
||||||
}
|
}
|
||||||
|
|
||||||
int signal_index;
|
int signal_index;
|
||||||
@ -2719,13 +2719,13 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
|
|||||||
// is -1 then this signal is not a member of sender.
|
// is -1 then this signal is not a member of sender.
|
||||||
if (signal.mobj && signal_index == -1) {
|
if (signal.mobj && signal_index == -1) {
|
||||||
qWarning("QObject::disconect: signal %s not found on class %s",
|
qWarning("QObject::disconect: signal %s not found on class %s",
|
||||||
signal.signature(), sender->metaObject()->className());
|
signal.methodSignature().constData(), sender->metaObject()->className());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// If this condition is true then method is not a member of receeiver.
|
// If this condition is true then method is not a member of receeiver.
|
||||||
if (receiver && method.mobj && method_index == -1) {
|
if (receiver && method.mobj && method_index == -1) {
|
||||||
qWarning("QObject::disconect: method %s not found on class %s",
|
qWarning("QObject::disconect: method %s not found on class %s",
|
||||||
method.signature(), receiver->metaObject()->className());
|
method.methodSignature().constData(), receiver->metaObject()->className());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3040,7 +3040,8 @@ void QMetaObject::connectSlotsByName(QObject *o)
|
|||||||
Q_ASSERT(mo);
|
Q_ASSERT(mo);
|
||||||
const QObjectList list = o->findChildren<QObject *>(QString());
|
const QObjectList list = o->findChildren<QObject *>(QString());
|
||||||
for (int i = 0; i < mo->methodCount(); ++i) {
|
for (int i = 0; i < mo->methodCount(); ++i) {
|
||||||
const char *slot = mo->method(i).signature();
|
QByteArray slotSignature = mo->method(i).methodSignature();
|
||||||
|
const char *slot = slotSignature.constData();
|
||||||
Q_ASSERT(slot);
|
Q_ASSERT(slot);
|
||||||
if (slot[0] != 'o' || slot[1] != 'n' || slot[2] != '_')
|
if (slot[0] != 'o' || slot[1] != 'n' || slot[2] != '_')
|
||||||
continue;
|
continue;
|
||||||
@ -3060,7 +3061,7 @@ void QMetaObject::connectSlotsByName(QObject *o)
|
|||||||
if (method.methodType() != QMetaMethod::Signal)
|
if (method.methodType() != QMetaMethod::Signal)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!qstrncmp(method.signature(), slot + len + 4, slotlen)) {
|
if (!qstrncmp(method.methodSignature().constData(), slot + len + 4, slotlen)) {
|
||||||
int signalOffset, methodOffset;
|
int signalOffset, methodOffset;
|
||||||
computeOffsets(method.enclosingMetaObject(), &signalOffset, &methodOffset);
|
computeOffsets(method.enclosingMetaObject(), &signalOffset, &methodOffset);
|
||||||
sigIndex = k + - methodOffset + signalOffset;
|
sigIndex = k + - methodOffset + signalOffset;
|
||||||
@ -3531,7 +3532,7 @@ void QObject::dumpObjectInfo()
|
|||||||
offset = methodOffset - signalOffset;
|
offset = methodOffset - signalOffset;
|
||||||
}
|
}
|
||||||
const QMetaMethod signal = metaObject()->method(signal_index + offset);
|
const QMetaMethod signal = metaObject()->method(signal_index + offset);
|
||||||
qDebug(" signal: %s", signal.signature());
|
qDebug(" signal: %s", signal.methodSignature().constData());
|
||||||
|
|
||||||
// receivers
|
// receivers
|
||||||
const QObjectPrivate::Connection *c =
|
const QObjectPrivate::Connection *c =
|
||||||
@ -3547,7 +3548,7 @@ void QObject::dumpObjectInfo()
|
|||||||
qDebug(" --> %s::%s %s",
|
qDebug(" --> %s::%s %s",
|
||||||
receiverMetaObject->className(),
|
receiverMetaObject->className(),
|
||||||
c->receiver->objectName().isEmpty() ? "unnamed" : qPrintable(c->receiver->objectName()),
|
c->receiver->objectName().isEmpty() ? "unnamed" : qPrintable(c->receiver->objectName()),
|
||||||
method.signature());
|
method.methodSignature().constData());
|
||||||
c = c->nextConnectionList;
|
c = c->nextConnectionList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3564,7 +3565,7 @@ void QObject::dumpObjectInfo()
|
|||||||
qDebug(" <-- %s::%s %s",
|
qDebug(" <-- %s::%s %s",
|
||||||
s->sender->metaObject()->className(),
|
s->sender->metaObject()->className(),
|
||||||
s->sender->objectName().isEmpty() ? "unnamed" : qPrintable(s->sender->objectName()),
|
s->sender->objectName().isEmpty() ? "unnamed" : qPrintable(s->sender->objectName()),
|
||||||
slot.signature());
|
slot.methodSignature().constData());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug(" <None>");
|
qDebug(" <None>");
|
||||||
|
@ -1657,7 +1657,7 @@ void QStateMachinePrivate::handleTransitionSignal(QObject *sender, int signalInd
|
|||||||
|
|
||||||
#ifdef QSTATEMACHINE_DEBUG
|
#ifdef QSTATEMACHINE_DEBUG
|
||||||
qDebug() << q_func() << ": sending signal event ( sender =" << sender
|
qDebug() << q_func() << ": sending signal event ( sender =" << sender
|
||||||
<< ", signal =" << sender->metaObject()->method(signalIndex).signature() << ')';
|
<< ", signal =" << sender->metaObject()->method(signalIndex).methodSignature().constData() << ')';
|
||||||
#endif
|
#endif
|
||||||
postInternalEvent(new QStateMachine::SignalEvent(sender, signalIndex, vargs));
|
postInternalEvent(new QStateMachine::SignalEvent(sender, signalIndex, vargs));
|
||||||
processEvents(DirectProcessing);
|
processEvents(DirectProcessing);
|
||||||
|
@ -181,7 +181,7 @@ void QDBusAbstractAdaptor::setAutoRelaySignals(bool enable)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// try to connect/disconnect to a signal on the parent that has the same method signature
|
// try to connect/disconnect to a signal on the parent that has the same method signature
|
||||||
QByteArray sig = QMetaObject::normalizedSignature(mm.signature());
|
QByteArray sig = QMetaObject::normalizedSignature(mm.methodSignature().constData());
|
||||||
if (them->indexOfSignal(sig) == -1)
|
if (them->indexOfSignal(sig) == -1)
|
||||||
continue;
|
continue;
|
||||||
sig.prepend(QSIGNAL_CODE + '0');
|
sig.prepend(QSIGNAL_CODE + '0');
|
||||||
@ -307,7 +307,7 @@ void QDBusAdaptorConnector::relay(QObject *senderObj, int lastSignalIdx, void **
|
|||||||
// invalid signal signature
|
// invalid signal signature
|
||||||
// qDBusParametersForMethod has not yet complained about this one
|
// qDBusParametersForMethod has not yet complained about this one
|
||||||
qWarning("QDBusAbstractAdaptor: Cannot relay signal %s::%s",
|
qWarning("QDBusAbstractAdaptor: Cannot relay signal %s::%s",
|
||||||
senderMetaObject->className(), mm.signature());
|
senderMetaObject->className(), mm.methodSignature().constData());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode,
|
|||||||
|
|
||||||
for (int i = staticMetaObject.methodCount(); i < mo->methodCount(); ++i) {
|
for (int i = staticMetaObject.methodCount(); i < mo->methodCount(); ++i) {
|
||||||
QMetaMethod mm = mo->method(i);
|
QMetaMethod mm = mo->method(i);
|
||||||
if (QByteArray(mm.signature()).startsWith(match)) {
|
if (mm.methodSignature().startsWith(match)) {
|
||||||
// found a method with the same name as what we're looking for
|
// found a method with the same name as what we're looking for
|
||||||
// hopefully, nobody is overloading asynchronous and synchronous methods with
|
// hopefully, nobody is overloading asynchronous and synchronous methods with
|
||||||
// the same name
|
// the same name
|
||||||
|
@ -640,7 +640,7 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check name:
|
// check name:
|
||||||
QByteArray slotname = mm.signature();
|
QByteArray slotname = mm.methodSignature();
|
||||||
int paren = slotname.indexOf('(');
|
int paren = slotname.indexOf('(');
|
||||||
if (paren != name.length() || !slotname.startsWith(name))
|
if (paren != name.length() || !slotname.startsWith(name))
|
||||||
continue;
|
continue;
|
||||||
@ -1188,7 +1188,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
|
|||||||
QString interface = qDBusInterfaceFromMetaObject(mo);
|
QString interface = qDBusInterfaceFromMetaObject(mo);
|
||||||
|
|
||||||
QMetaMethod mm = mo->method(signalId);
|
QMetaMethod mm = mo->method(signalId);
|
||||||
QByteArray memberName = mm.signature();
|
QByteArray memberName = mm.methodSignature();
|
||||||
memberName.truncate(memberName.indexOf('('));
|
memberName.truncate(memberName.indexOf('('));
|
||||||
|
|
||||||
// check if it's scriptable
|
// check if it's scriptable
|
||||||
|
@ -141,7 +141,7 @@ int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes)
|
|||||||
for ( ; it != end; ++it) {
|
for ( ; it != end; ++it) {
|
||||||
const QByteArray &type = *it;
|
const QByteArray &type = *it;
|
||||||
if (type.endsWith('*')) {
|
if (type.endsWith('*')) {
|
||||||
//qWarning("Could not parse the method '%s'", mm.signature());
|
//qWarning("Could not parse the method '%s'", mm.methodSignature().constData());
|
||||||
// pointer?
|
// pointer?
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes)
|
|||||||
|
|
||||||
int id = QMetaType::type(basictype);
|
int id = QMetaType::type(basictype);
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
//qWarning("Could not parse the method '%s'", mm.signature());
|
//qWarning("Could not parse the method '%s'", mm.methodSignature().constData());
|
||||||
// invalid type in method parameter list
|
// invalid type in method parameter list
|
||||||
return -1;
|
return -1;
|
||||||
} else if (QDBusMetaType::typeToSignature(id) == 0)
|
} else if (QDBusMetaType::typeToSignature(id) == 0)
|
||||||
@ -164,14 +164,14 @@ int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (seenMessage) { // && !type.endsWith('&')
|
if (seenMessage) { // && !type.endsWith('&')
|
||||||
//qWarning("Could not parse the method '%s'", mm.signature());
|
//qWarning("Could not parse the method '%s'", mm.methodSignature().constData());
|
||||||
// non-output parameters after message or after output params
|
// non-output parameters after message or after output params
|
||||||
return -1; // not allowed
|
return -1; // not allowed
|
||||||
}
|
}
|
||||||
|
|
||||||
int id = QMetaType::type(type);
|
int id = QMetaType::type(type);
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
//qWarning("Could not parse the method '%s'", mm.signature());
|
//qWarning("Could not parse the method '%s'", mm.methodSignature().constData());
|
||||||
// invalid type in method parameter list
|
// invalid type in method parameter list
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
|||||||
// now add methods:
|
// now add methods:
|
||||||
for (int i = methodOffset; i < mo->methodCount(); ++i) {
|
for (int i = methodOffset; i < mo->methodCount(); ++i) {
|
||||||
QMetaMethod mm = mo->method(i);
|
QMetaMethod mm = mo->method(i);
|
||||||
QByteArray signature = mm.signature();
|
QByteArray signature = mm.methodSignature();
|
||||||
int paren = signature.indexOf('(');
|
int paren = signature.indexOf('(');
|
||||||
|
|
||||||
bool isSignal;
|
bool isSignal;
|
||||||
|
@ -78,10 +78,10 @@ QList<QByteArray> QAccessibleObjectPrivate::actionList() const
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!qstrcmp(member.tag(), "QACCESSIBLE_SLOT")) {
|
if (!qstrcmp(member.tag(), "QACCESSIBLE_SLOT")) {
|
||||||
if (member.signature() == defaultAction)
|
if (member.methodSignature() == defaultAction)
|
||||||
actionList.prepend(defaultAction);
|
actionList.prepend(defaultAction);
|
||||||
else
|
else
|
||||||
actionList << member.signature();
|
actionList << member.methodSignature();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ enum { IndentSpacesCount = 4 };
|
|||||||
|
|
||||||
static QByteArray memberName(const QMetaMethod &member)
|
static QByteArray memberName(const QMetaMethod &member)
|
||||||
{
|
{
|
||||||
QByteArray ba = member.signature();
|
QByteArray ba = member.methodSignature();
|
||||||
return ba.left(ba.indexOf('('));
|
return ba.left(ba.indexOf('('));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ static void qSignalDumperCallbackSlot(QObject *caller, int method_index, void **
|
|||||||
str += QByteArray::number(quintptr(caller), 16);
|
str += QByteArray::number(quintptr(caller), 16);
|
||||||
|
|
||||||
str += ") ";
|
str += ") ";
|
||||||
str += member.signature();
|
str += member.methodSignature();
|
||||||
qPrintMessage(str);
|
qPrintMessage(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,7 +1061,8 @@ static bool isValidSlot(const QMetaMethod &sl)
|
|||||||
if (sl.access() != QMetaMethod::Private || !sl.parameterTypes().isEmpty()
|
if (sl.access() != QMetaMethod::Private || !sl.parameterTypes().isEmpty()
|
||||||
|| qstrlen(sl.typeName()) || sl.methodType() != QMetaMethod::Slot)
|
|| qstrlen(sl.typeName()) || sl.methodType() != QMetaMethod::Slot)
|
||||||
return false;
|
return false;
|
||||||
const char *sig = sl.signature();
|
QByteArray signature = sl.methodSignature();
|
||||||
|
const char *sig = signature.constData();
|
||||||
int len = qstrlen(sig);
|
int len = qstrlen(sig);
|
||||||
if (len < 2)
|
if (len < 2)
|
||||||
return false;
|
return false;
|
||||||
@ -1084,7 +1085,7 @@ static void qPrintTestSlots(FILE *stream)
|
|||||||
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
|
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
|
||||||
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
|
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
|
||||||
if (isValidSlot(sl))
|
if (isValidSlot(sl))
|
||||||
fprintf(stream, "%s\n", sl.signature());
|
fprintf(stream, "%s\n", sl.methodSignature().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1109,7 +1110,7 @@ static void qPrintDataTags(FILE *stream)
|
|||||||
// Retrieve local tags:
|
// Retrieve local tags:
|
||||||
QStringList localTags;
|
QStringList localTags;
|
||||||
QTestTable table;
|
QTestTable table;
|
||||||
char *slot = qstrdup(tf.signature());
|
char *slot = qstrdup(tf.methodSignature().constData());
|
||||||
slot[strlen(slot) - 2] = '\0';
|
slot[strlen(slot) - 2] = '\0';
|
||||||
QByteArray member;
|
QByteArray member;
|
||||||
member.resize(qstrlen(slot) + qstrlen("_data()") + 1);
|
member.resize(qstrlen(slot) + qstrlen("_data()") + 1);
|
||||||
@ -1779,7 +1780,7 @@ static void qInvokeTestMethods(QObject *testObject)
|
|||||||
|
|
||||||
if (QTest::testFuncs) {
|
if (QTest::testFuncs) {
|
||||||
for (int i = 0; i != QTest::testFuncCount; i++) {
|
for (int i = 0; i != QTest::testFuncCount; i++) {
|
||||||
if (!qInvokeTestMethod(metaObject->method(QTest::testFuncs[i].function()).signature(),
|
if (!qInvokeTestMethod(metaObject->method(QTest::testFuncs[i].function()).methodSignature().constData(),
|
||||||
QTest::testFuncs[i].data())) {
|
QTest::testFuncs[i].data())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1793,7 +1794,7 @@ static void qInvokeTestMethods(QObject *testObject)
|
|||||||
for (int i = 0; i != methodCount; i++) {
|
for (int i = 0; i != methodCount; i++) {
|
||||||
if (!isValidSlot(testMethods[i]))
|
if (!isValidSlot(testMethods[i]))
|
||||||
continue;
|
continue;
|
||||||
if (!qInvokeTestMethod(testMethods[i].signature()))
|
if (!qInvokeTestMethod(testMethods[i].methodSignature().constData()))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delete[] testMethods;
|
delete[] testMethods;
|
||||||
|
@ -603,7 +603,7 @@ void tst_QMetaMethod::method()
|
|||||||
QCOMPARE(method.methodType(), methodType);
|
QCOMPARE(method.methodType(), methodType);
|
||||||
QCOMPARE(method.access(), access);
|
QCOMPARE(method.access(), access);
|
||||||
|
|
||||||
QCOMPARE(method.signature(), signature.constData());
|
QCOMPARE(method.methodSignature(), signature);
|
||||||
|
|
||||||
QCOMPARE(method.tag(), "");
|
QCOMPARE(method.tag(), "");
|
||||||
|
|
||||||
|
@ -978,25 +978,25 @@ void tst_QMetaObject::propertyNotify()
|
|||||||
QVERIFY(prop.isValid());
|
QVERIFY(prop.isValid());
|
||||||
QVERIFY(prop.hasNotifySignal());
|
QVERIFY(prop.hasNotifySignal());
|
||||||
QMetaMethod signal = prop.notifySignal();
|
QMetaMethod signal = prop.notifySignal();
|
||||||
QCOMPARE(signal.signature(), "value6Changed()");
|
QCOMPARE(signal.methodSignature(), QByteArray("value6Changed()"));
|
||||||
|
|
||||||
prop = mo->property(mo->indexOfProperty("value7"));
|
prop = mo->property(mo->indexOfProperty("value7"));
|
||||||
QVERIFY(prop.isValid());
|
QVERIFY(prop.isValid());
|
||||||
QVERIFY(prop.hasNotifySignal());
|
QVERIFY(prop.hasNotifySignal());
|
||||||
signal = prop.notifySignal();
|
signal = prop.notifySignal();
|
||||||
QCOMPARE(signal.signature(), "value7Changed(QString)");
|
QCOMPARE(signal.methodSignature(), QByteArray("value7Changed(QString)"));
|
||||||
|
|
||||||
prop = mo->property(mo->indexOfProperty("value8"));
|
prop = mo->property(mo->indexOfProperty("value8"));
|
||||||
QVERIFY(prop.isValid());
|
QVERIFY(prop.isValid());
|
||||||
QVERIFY(!prop.hasNotifySignal());
|
QVERIFY(!prop.hasNotifySignal());
|
||||||
signal = prop.notifySignal();
|
signal = prop.notifySignal();
|
||||||
QCOMPARE(signal.signature(), (const char *)0);
|
QCOMPARE(signal.methodSignature(), QByteArray());
|
||||||
|
|
||||||
prop = mo->property(mo->indexOfProperty("value"));
|
prop = mo->property(mo->indexOfProperty("value"));
|
||||||
QVERIFY(prop.isValid());
|
QVERIFY(prop.isValid());
|
||||||
QVERIFY(!prop.hasNotifySignal());
|
QVERIFY(!prop.hasNotifySignal());
|
||||||
signal = prop.notifySignal();
|
signal = prop.notifySignal();
|
||||||
QCOMPARE(signal.signature(), (const char *)0);
|
QCOMPARE(signal.methodSignature(), QByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QMetaObject::propertyConstant()
|
void tst_QMetaObject::propertyConstant()
|
||||||
@ -1114,7 +1114,7 @@ void tst_QMetaObject::indexOfMethod()
|
|||||||
QFETCH(bool, isSignal);
|
QFETCH(bool, isSignal);
|
||||||
int idx = object->metaObject()->indexOfMethod(name);
|
int idx = object->metaObject()->indexOfMethod(name);
|
||||||
QVERIFY(idx >= 0);
|
QVERIFY(idx >= 0);
|
||||||
QCOMPARE(object->metaObject()->method(idx).signature(), name.constData());
|
QCOMPARE(object->metaObject()->method(idx).methodSignature(), name);
|
||||||
QCOMPARE(object->metaObject()->indexOfSlot(name), isSignal ? -1 : idx);
|
QCOMPARE(object->metaObject()->indexOfSlot(name), isSignal ? -1 : idx);
|
||||||
QCOMPARE(object->metaObject()->indexOfSignal(name), !isSignal ? -1 : idx);
|
QCOMPARE(object->metaObject()->indexOfSignal(name), !isSignal ? -1 : idx);
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1161,7 @@ bool tst_QMetaObjectBuilder::checkForSideEffects
|
|||||||
|
|
||||||
static bool sameMethod(const QMetaMethod& method1, const QMetaMethod& method2)
|
static bool sameMethod(const QMetaMethod& method1, const QMetaMethod& method2)
|
||||||
{
|
{
|
||||||
if (QByteArray(method1.signature()) != QByteArray(method2.signature()))
|
if (method1.methodSignature() != method2.methodSignature())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (QByteArray(method1.typeName()) != QByteArray(method2.typeName()))
|
if (QByteArray(method1.typeName()) != QByteArray(method2.typeName()))
|
||||||
@ -1466,7 +1466,7 @@ void TestObject::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id,
|
|||||||
if (_a[0]) *reinterpret_cast<QObject**>(_a[0]) = _r; } break;
|
if (_a[0]) *reinterpret_cast<QObject**>(_a[0]) = _r; } break;
|
||||||
default: {
|
default: {
|
||||||
QMetaMethod ctor = _o->metaObject()->constructor(_id);
|
QMetaMethod ctor = _o->metaObject()->constructor(_id);
|
||||||
qFatal("You forgot to add a case for CreateInstance %s", ctor.signature());
|
qFatal("You forgot to add a case for CreateInstance %s", ctor.methodSignature().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_c == QMetaObject::InvokeMetaMethod) {
|
} else if (_c == QMetaObject::InvokeMetaMethod) {
|
||||||
@ -1478,7 +1478,7 @@ void TestObject::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id,
|
|||||||
case 2: *reinterpret_cast<QVariantList(*)>(_a[0]) = _t->listInvokableQRealQString(*reinterpret_cast<qreal(*)>(_a[1]), *reinterpret_cast<QString(*)>(_a[2])); break;
|
case 2: *reinterpret_cast<QVariantList(*)>(_a[0]) = _t->listInvokableQRealQString(*reinterpret_cast<qreal(*)>(_a[1]), *reinterpret_cast<QString(*)>(_a[2])); break;
|
||||||
default: {
|
default: {
|
||||||
QMetaMethod method = _o->metaObject()->method(_o->metaObject()->methodOffset() + _id);
|
QMetaMethod method = _o->metaObject()->method(_o->metaObject()->methodOffset() + _id);
|
||||||
qFatal("You forgot to add a case for InvokeMetaMethod %s", method.signature());
|
qFatal("You forgot to add a case for InvokeMetaMethod %s", method.methodSignature().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_c == QMetaObject::IndexOfMethod) {
|
} else if (_c == QMetaObject::IndexOfMethod) {
|
||||||
|
@ -1793,56 +1793,56 @@ void tst_QObject::metamethod()
|
|||||||
QMetaMethod m;
|
QMetaMethod m;
|
||||||
|
|
||||||
m = mobj->method(mobj->indexOfMethod("invoke1()"));
|
m = mobj->method(mobj->indexOfMethod("invoke1()"));
|
||||||
QVERIFY(QByteArray(m.signature()) == "invoke1()");
|
QVERIFY(m.methodSignature() == "invoke1()");
|
||||||
QVERIFY(m.methodType() == QMetaMethod::Method);
|
QVERIFY(m.methodType() == QMetaMethod::Method);
|
||||||
QVERIFY(m.access() == QMetaMethod::Public);
|
QVERIFY(m.access() == QMetaMethod::Public);
|
||||||
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
||||||
QVERIFY(!(m.attributes() & QMetaMethod::Compatibility));
|
QVERIFY(!(m.attributes() & QMetaMethod::Compatibility));
|
||||||
|
|
||||||
m = mobj->method(mobj->indexOfMethod("sinvoke1()"));
|
m = mobj->method(mobj->indexOfMethod("sinvoke1()"));
|
||||||
QVERIFY(QByteArray(m.signature()) == "sinvoke1()");
|
QVERIFY(m.methodSignature() == "sinvoke1()");
|
||||||
QVERIFY(m.methodType() == QMetaMethod::Method);
|
QVERIFY(m.methodType() == QMetaMethod::Method);
|
||||||
QVERIFY(m.access() == QMetaMethod::Public);
|
QVERIFY(m.access() == QMetaMethod::Public);
|
||||||
QVERIFY((m.attributes() & QMetaMethod::Scriptable));
|
QVERIFY((m.attributes() & QMetaMethod::Scriptable));
|
||||||
QVERIFY(!(m.attributes() & QMetaMethod::Compatibility));
|
QVERIFY(!(m.attributes() & QMetaMethod::Compatibility));
|
||||||
|
|
||||||
m = mobj->method(mobj->indexOfMethod("invoke2()"));
|
m = mobj->method(mobj->indexOfMethod("invoke2()"));
|
||||||
QVERIFY(QByteArray(m.signature()) == "invoke2()");
|
QVERIFY(m.methodSignature() == "invoke2()");
|
||||||
QVERIFY(m.methodType() == QMetaMethod::Method);
|
QVERIFY(m.methodType() == QMetaMethod::Method);
|
||||||
QVERIFY(m.access() == QMetaMethod::Protected);
|
QVERIFY(m.access() == QMetaMethod::Protected);
|
||||||
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
||||||
QVERIFY((m.attributes() & QMetaMethod::Compatibility));
|
QVERIFY((m.attributes() & QMetaMethod::Compatibility));
|
||||||
|
|
||||||
m = mobj->method(mobj->indexOfMethod("sinvoke2()"));
|
m = mobj->method(mobj->indexOfMethod("sinvoke2()"));
|
||||||
QVERIFY(QByteArray(m.signature()) == "sinvoke2()");
|
QVERIFY(m.methodSignature() == "sinvoke2()");
|
||||||
QVERIFY(m.methodType() == QMetaMethod::Method);
|
QVERIFY(m.methodType() == QMetaMethod::Method);
|
||||||
QVERIFY(m.access() == QMetaMethod::Protected);
|
QVERIFY(m.access() == QMetaMethod::Protected);
|
||||||
QVERIFY((m.attributes() & QMetaMethod::Scriptable));
|
QVERIFY((m.attributes() & QMetaMethod::Scriptable));
|
||||||
QVERIFY((m.attributes() & QMetaMethod::Compatibility));
|
QVERIFY((m.attributes() & QMetaMethod::Compatibility));
|
||||||
|
|
||||||
m = mobj->method(mobj->indexOfMethod("invoke3()"));
|
m = mobj->method(mobj->indexOfMethod("invoke3()"));
|
||||||
QVERIFY(QByteArray(m.signature()) == "invoke3()");
|
QVERIFY(m.methodSignature() == "invoke3()");
|
||||||
QVERIFY(m.methodType() == QMetaMethod::Method);
|
QVERIFY(m.methodType() == QMetaMethod::Method);
|
||||||
QVERIFY(m.access() == QMetaMethod::Private);
|
QVERIFY(m.access() == QMetaMethod::Private);
|
||||||
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
||||||
QVERIFY(!(m.attributes() & QMetaMethod::Compatibility));
|
QVERIFY(!(m.attributes() & QMetaMethod::Compatibility));
|
||||||
|
|
||||||
m = mobj->method(mobj->indexOfMethod("sinvoke3()"));
|
m = mobj->method(mobj->indexOfMethod("sinvoke3()"));
|
||||||
QVERIFY(QByteArray(m.signature()) == "sinvoke3()");
|
QVERIFY(m.methodSignature() == "sinvoke3()");
|
||||||
QVERIFY(m.methodType() == QMetaMethod::Method);
|
QVERIFY(m.methodType() == QMetaMethod::Method);
|
||||||
QVERIFY(m.access() == QMetaMethod::Private);
|
QVERIFY(m.access() == QMetaMethod::Private);
|
||||||
QVERIFY((m.attributes() & QMetaMethod::Scriptable));
|
QVERIFY((m.attributes() & QMetaMethod::Scriptable));
|
||||||
QVERIFY(!(m.attributes() & QMetaMethod::Compatibility));
|
QVERIFY(!(m.attributes() & QMetaMethod::Compatibility));
|
||||||
|
|
||||||
m = mobj->method(mobj->indexOfMethod("signal5()"));
|
m = mobj->method(mobj->indexOfMethod("signal5()"));
|
||||||
QVERIFY(QByteArray(m.signature()) == "signal5()");
|
QVERIFY(m.methodSignature() == "signal5()");
|
||||||
QVERIFY(m.methodType() == QMetaMethod::Signal);
|
QVERIFY(m.methodType() == QMetaMethod::Signal);
|
||||||
QVERIFY(m.access() == QMetaMethod::Protected);
|
QVERIFY(m.access() == QMetaMethod::Protected);
|
||||||
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
||||||
QVERIFY((m.attributes() & QMetaMethod::Compatibility));
|
QVERIFY((m.attributes() & QMetaMethod::Compatibility));
|
||||||
|
|
||||||
m = mobj->method(mobj->indexOfMethod("aPublicSlot()"));
|
m = mobj->method(mobj->indexOfMethod("aPublicSlot()"));
|
||||||
QVERIFY(QByteArray(m.signature()) == "aPublicSlot()");
|
QVERIFY(m.methodSignature() == "aPublicSlot()");
|
||||||
QVERIFY(m.methodType() == QMetaMethod::Slot);
|
QVERIFY(m.methodType() == QMetaMethod::Slot);
|
||||||
QVERIFY(m.access() == QMetaMethod::Public);
|
QVERIFY(m.access() == QMetaMethod::Public);
|
||||||
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
|
||||||
|
@ -397,7 +397,7 @@ void tst_QDBusMetaObject::types()
|
|||||||
for (int i = metaobject->methodOffset(); i < metaobject->methodCount(); ++i) {
|
for (int i = metaobject->methodOffset(); i < metaobject->methodCount(); ++i) {
|
||||||
QMetaMethod expected = metaobject->method(i);
|
QMetaMethod expected = metaobject->method(i);
|
||||||
|
|
||||||
int methodIdx = result->indexOfMethod(expected.signature());
|
int methodIdx = result->indexOfMethod(expected.methodSignature().constData());
|
||||||
QVERIFY(methodIdx != -1);
|
QVERIFY(methodIdx != -1);
|
||||||
QMetaMethod constructed = result->method(methodIdx);
|
QMetaMethod constructed = result->method(methodIdx);
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ void tst_Moc::classinfoWithEscapes()
|
|||||||
QCOMPARE(mobj->methodCount() - mobj->methodOffset(), 1);
|
QCOMPARE(mobj->methodCount() - mobj->methodOffset(), 1);
|
||||||
|
|
||||||
QMetaMethod mm = mobj->method(mobj->methodOffset());
|
QMetaMethod mm = mobj->method(mobj->methodOffset());
|
||||||
QCOMPARE(mm.signature(), "slotWithAReallyLongName(int)");
|
QCOMPARE(mm.methodSignature(), QByteArray("slotWithAReallyLongName(int)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_Moc::trNoopInClassInfo()
|
void tst_Moc::trNoopInClassInfo()
|
||||||
@ -1092,14 +1092,14 @@ void tst_Moc::invokable()
|
|||||||
{
|
{
|
||||||
const QMetaObject &mobj = InvokableBeforeReturnType::staticMetaObject;
|
const QMetaObject &mobj = InvokableBeforeReturnType::staticMetaObject;
|
||||||
QCOMPARE(mobj.methodCount(), 6);
|
QCOMPARE(mobj.methodCount(), 6);
|
||||||
QVERIFY(mobj.method(5).signature() == QByteArray("foo()"));
|
QVERIFY(mobj.method(5).methodSignature() == QByteArray("foo()"));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const QMetaObject &mobj = InvokableBeforeInline::staticMetaObject;
|
const QMetaObject &mobj = InvokableBeforeInline::staticMetaObject;
|
||||||
QCOMPARE(mobj.methodCount(), 7);
|
QCOMPARE(mobj.methodCount(), 7);
|
||||||
QVERIFY(mobj.method(5).signature() == QByteArray("foo()"));
|
QVERIFY(mobj.method(5).methodSignature() == QByteArray("foo()"));
|
||||||
QVERIFY(mobj.method(6).signature() == QByteArray("bar()"));
|
QVERIFY(mobj.method(6).methodSignature() == QByteArray("bar()"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1108,22 +1108,22 @@ void tst_Moc::singleFunctionKeywordSignalAndSlot()
|
|||||||
{
|
{
|
||||||
const QMetaObject &mobj = SingleFunctionKeywordBeforeReturnType::staticMetaObject;
|
const QMetaObject &mobj = SingleFunctionKeywordBeforeReturnType::staticMetaObject;
|
||||||
QCOMPARE(mobj.methodCount(), 7);
|
QCOMPARE(mobj.methodCount(), 7);
|
||||||
QVERIFY(mobj.method(5).signature() == QByteArray("mySignal()"));
|
QVERIFY(mobj.method(5).methodSignature() == QByteArray("mySignal()"));
|
||||||
QVERIFY(mobj.method(6).signature() == QByteArray("mySlot()"));
|
QVERIFY(mobj.method(6).methodSignature() == QByteArray("mySlot()"));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const QMetaObject &mobj = SingleFunctionKeywordBeforeInline::staticMetaObject;
|
const QMetaObject &mobj = SingleFunctionKeywordBeforeInline::staticMetaObject;
|
||||||
QCOMPARE(mobj.methodCount(), 7);
|
QCOMPARE(mobj.methodCount(), 7);
|
||||||
QVERIFY(mobj.method(5).signature() == QByteArray("mySignal()"));
|
QVERIFY(mobj.method(5).methodSignature() == QByteArray("mySignal()"));
|
||||||
QVERIFY(mobj.method(6).signature() == QByteArray("mySlot()"));
|
QVERIFY(mobj.method(6).methodSignature() == QByteArray("mySlot()"));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const QMetaObject &mobj = SingleFunctionKeywordAfterInline::staticMetaObject;
|
const QMetaObject &mobj = SingleFunctionKeywordAfterInline::staticMetaObject;
|
||||||
QCOMPARE(mobj.methodCount(), 7);
|
QCOMPARE(mobj.methodCount(), 7);
|
||||||
QVERIFY(mobj.method(5).signature() == QByteArray("mySignal()"));
|
QVERIFY(mobj.method(5).methodSignature() == QByteArray("mySignal()"));
|
||||||
QVERIFY(mobj.method(6).signature() == QByteArray("mySlot()"));
|
QVERIFY(mobj.method(6).methodSignature() == QByteArray("mySlot()"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1230,7 +1230,7 @@ void tst_Moc::constructors()
|
|||||||
QMetaMethod mm = mo->constructor(0);
|
QMetaMethod mm = mo->constructor(0);
|
||||||
QCOMPARE(mm.access(), QMetaMethod::Public);
|
QCOMPARE(mm.access(), QMetaMethod::Public);
|
||||||
QCOMPARE(mm.methodType(), QMetaMethod::Constructor);
|
QCOMPARE(mm.methodType(), QMetaMethod::Constructor);
|
||||||
QCOMPARE(mm.signature(), "CtorTestClass(QObject*)");
|
QCOMPARE(mm.methodSignature(), QByteArray("CtorTestClass(QObject*)"));
|
||||||
QCOMPARE(mm.typeName(), "");
|
QCOMPARE(mm.typeName(), "");
|
||||||
QList<QByteArray> paramNames = mm.parameterNames();
|
QList<QByteArray> paramNames = mm.parameterNames();
|
||||||
QCOMPARE(paramNames.size(), 1);
|
QCOMPARE(paramNames.size(), 1);
|
||||||
@ -1243,7 +1243,7 @@ void tst_Moc::constructors()
|
|||||||
QMetaMethod mm = mo->constructor(1);
|
QMetaMethod mm = mo->constructor(1);
|
||||||
QCOMPARE(mm.access(), QMetaMethod::Public);
|
QCOMPARE(mm.access(), QMetaMethod::Public);
|
||||||
QCOMPARE(mm.methodType(), QMetaMethod::Constructor);
|
QCOMPARE(mm.methodType(), QMetaMethod::Constructor);
|
||||||
QCOMPARE(mm.signature(), "CtorTestClass()");
|
QCOMPARE(mm.methodSignature(), QByteArray("CtorTestClass()"));
|
||||||
QCOMPARE(mm.typeName(), "");
|
QCOMPARE(mm.typeName(), "");
|
||||||
QCOMPARE(mm.parameterNames().size(), 0);
|
QCOMPARE(mm.parameterNames().size(), 0);
|
||||||
QCOMPARE(mm.parameterTypes().size(), 0);
|
QCOMPARE(mm.parameterTypes().size(), 0);
|
||||||
@ -1252,7 +1252,7 @@ void tst_Moc::constructors()
|
|||||||
QMetaMethod mm = mo->constructor(2);
|
QMetaMethod mm = mo->constructor(2);
|
||||||
QCOMPARE(mm.access(), QMetaMethod::Public);
|
QCOMPARE(mm.access(), QMetaMethod::Public);
|
||||||
QCOMPARE(mm.methodType(), QMetaMethod::Constructor);
|
QCOMPARE(mm.methodType(), QMetaMethod::Constructor);
|
||||||
QCOMPARE(mm.signature(), "CtorTestClass(QString)");
|
QCOMPARE(mm.methodSignature(), QByteArray("CtorTestClass(QString)"));
|
||||||
QCOMPARE(mm.typeName(), "");
|
QCOMPARE(mm.typeName(), "");
|
||||||
QList<QByteArray> paramNames = mm.parameterNames();
|
QList<QByteArray> paramNames = mm.parameterNames();
|
||||||
QCOMPARE(paramNames.size(), 1);
|
QCOMPARE(paramNames.size(), 1);
|
||||||
|
@ -1275,7 +1275,7 @@ static int numberOfConnectedSignals(MySubWindow *subWindow)
|
|||||||
QMetaMethod method = subWindow->metaObject()->method(i);
|
QMetaMethod method = subWindow->metaObject()->method(i);
|
||||||
if (method.methodType() == QMetaMethod::Signal) {
|
if (method.methodType() == QMetaMethod::Signal) {
|
||||||
QString signature(QLatin1String("2"));
|
QString signature(QLatin1String("2"));
|
||||||
signature += QLatin1String(method.signature());
|
signature += QLatin1String(method.methodSignature().constData());
|
||||||
numConnectedSignals += subWindow->receivers(signature.toLatin1());
|
numConnectedSignals += subWindow->receivers(signature.toLatin1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ void tst_qmetaobject::indexOfMethod_data()
|
|||||||
const QMetaObject *mo = &QTreeView::staticMetaObject;
|
const QMetaObject *mo = &QTreeView::staticMetaObject;
|
||||||
for (int i = 0; i < mo->methodCount(); ++i) {
|
for (int i = 0; i < mo->methodCount(); ++i) {
|
||||||
QMetaMethod method = mo->method(i);
|
QMetaMethod method = mo->method(i);
|
||||||
QByteArray sig = method.signature();
|
QByteArray sig = method.methodSignature();
|
||||||
QTest::newRow(sig) << sig;
|
QTest::newRow(sig) << sig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ void tst_qmetaobject::indexOfSignal_data()
|
|||||||
QMetaMethod method = mo->method(i);
|
QMetaMethod method = mo->method(i);
|
||||||
if (method.methodType() != QMetaMethod::Signal)
|
if (method.methodType() != QMetaMethod::Signal)
|
||||||
continue;
|
continue;
|
||||||
QByteArray sig = method.signature();
|
QByteArray sig = method.methodSignature();
|
||||||
QTest::newRow(sig) << sig;
|
QTest::newRow(sig) << sig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ void tst_qmetaobject::indexOfSlot_data()
|
|||||||
QMetaMethod method = mo->method(i);
|
QMetaMethod method = mo->method(i);
|
||||||
if (method.methodType() != QMetaMethod::Slot)
|
if (method.methodType() != QMetaMethod::Slot)
|
||||||
continue;
|
continue;
|
||||||
QByteArray sig = method.signature();
|
QByteArray sig = method.methodSignature();
|
||||||
QTest::newRow(sig) << sig;
|
QTest::newRow(sig) << sig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user