[Interest] invokeMethod, Q_RETURN_ARG and qint32

Dmitry Kozlov gnitry at mail.ru
Tue Aug 6 08:02:29 CEST 2013


Hello.
I have a problem with invoking method with qint32 return type. 
QMetaObject::invokeMethod always returns false -> method doesn't called.

// main.cpp

#include "myobj.h"
#include <QDebug>
#include <QMetaObject>

int main(int argc, char *argv[])
{
     MyObj obj;
     qint32 result;
     qDebug() << "invoke" << QMetaObject::invokeMethod(&obj, "method", 
Qt::DirectConnection, Q_RETURN_ARG(qint32, result));
}

// myobj.h

#include <QObject>
class MyObj : public QObject
{
     Q_OBJECT
public:
     Q_INVOKABLE qint32 method()
     { return 123;  }
};


But, when i replace invoke code with "QMetaObject::invokeMethod(&obj, 
"method", Qt::DirectConnection, Q_RETURN_ARG(*int*, result));" this 
works fine. I think, problem in meta system, but how to solve this?

System details:
     Qt 5.1
     Ubuntu 13.04 (x86)
     GCC 4.7.3

PS: everything works fine in Qt 4.8.5.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130806/eeb85d30/attachment.html>


More information about the Interest mailing list