[Interest] Access QVariant's raw data

Jonas Gehring jonas.gehring at boolsoft.org
Sun Apr 8 04:24:01 CEST 2012


Hi there,

Does anybody know a way to access the raw data inside a QVariant?

Just for clarification: I know about Q_DECLARE_METATYPE,
qRegisterMetaType etc. I'm currently passing user-defined type
that are boxed inside a QVariant across different threads, and
at some point I'm invoking a slot initially defined by the
caller. Ideally, I'd like to do:

  QVariant result = ...;     // Just received from thread
  QMetaMethod method = ...;  // Pass the result to this method
  method.invoke(receiver, QGenericArgument(result.typeName(), result.value<void *>()));

result.value<void *>() returns a NULL pointer, although the
type name (and the actual value) are correct. Is there
another way or am I missing something?

Regards,
Jonas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120408/e99421a9/attachment.sig>


More information about the Interest mailing list