On 4/8/12 3:29 PM, Thiago Macieira wrote: > On domingo, 8 de abril de 2012 13.00.28, Jonas Gehring wrote: >> Hi Thiago, >> >> On 4/8/12 5:16 AM, Thiago Macieira wrote: >>>> QVariant result = ...; // Just received from thread >>>> QMetaMethod method = ...; // Pass the result to this method >>>> method.invoke(receiver, QGenericArgument(result.typeName(), >>>> >>>> result.value<void *>())); >>> >>> You're not supposed to use QGenericArgument directly. Use Q_ARG. >> >> Thanks for your clarifications. Is there a way to achieve the desired >> behavior with Q_ARG? The main point is that I don't know the actual type >> of the result, but the QVariant does (although not via templates, >> apparently). > > Then take a look at what Q_ARG does and replicate it for your code. It does > not involve value<void *>().
Q_ARG(type, data) is defined as QArgument<type>(#type, data), but I can't write it that way since I don't have the actual type of result and thus can't use templates. Anyway, I managed to achieve the desired behaviour by constructing a QGenericArgument whit QVariant.constData(). If you happen to know another way to manage this without templates, please let me know. Regards, Jonas
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
