[Interest] Access QVariant's raw data

Thiago Macieira thiago.macieira at intel.com
Sun Apr 8 15:29:17 CEST 2012


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 *>().

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120408/683b1929/attachment.sig>


More information about the Interest mailing list