[Qt-interest] Store a QVariant in a QVariant

Giuseppe D'Angelo dangelog at gmail.com
Mon Sep 19 18:36:21 CEST 2011


On Mon, Sep 19, 2011 at 5:52 PM, BOUCARD Olivier
<boucard_olivier at yahoo.fr> wrote:
> Hi all,
> Basically, what I want to achieve its to store a QVariant A, which stores a
> value of type X, in a QVariant B in way that B.typeName() return "QVariant"
> and not "X".
> I do not know if it is feasible. I try to force the type using
> QVariant::fromValue but it does not work.

qVariantFromValue has a template specialization for that case...
http://qt.gitorious.org/qt/qt/blobs/4.7/src/corelib/kernel/qvariant.h#line454

QVariant B(QMetaType::QVariant, &A); ?
-- 
Giuseppe D'Angelo



More information about the Qt-interest-old mailing list