PDA

View Full Version : Usage of QMetaMethod::invoke(...)



falko.wiese
5th February 2013, 17:11
Hi guys,
it's pretty tough to implement a generic interface to invoke different methods, since those methods have different parameter lists. Maybe I misunderstood the QMetaMethod::invoke() interface ... Actually, I do something as follows:

QList parameters;
...
bool success = method.invoke(receiver, Qt::AutoConnection, Q_RETURN_ARG(...), parameters.at(0), parameters.at(1), ...);

What I want to do is:
...
bool success = method.invoke(..., parameters);

Is something comparable possible?


Thanks for your time,
Falko.

wysota
5th February 2013, 18:36
Does the method accept a list or do you want to simply pass a series of separate arguments as a list?

falko.wiese
5th February 2013, 19:23
Hmm, I assume, I got it ... it isn't so tough, as it seemed before. :)

First of all I initialized the above mentioned parameter list. After that, I can call QMetaMethod::invoke(...) only once in my code with the maximal number of arguments. Most of it are normally initialized with 0. It works that way.

Sorry,
Falko.