[Qt-interest] QVariant and protected structs

andrew.m.goth at l-3com.com andrew.m.goth at l-3com.com
Fri Apr 3 07:49:14 CEST 2009


How do I make a QVariant that contains a pointer to a struct that is
protected?  Do I really need Q_DECLARE_METATYPE when I'm dealing with
pointers?  Can I use friend declarations?

Here's some code that doesn't work. :^)

class Whatever {
public:
    Whatever();
protected:
    struct Contained {
        int x;
    };
    Contained contained;
    QVariant pointer;
};

Q_DECLARE_METATYPE(Whatever::Contained*);

Whatever::Whatever()
{
    pointer = QVariant::fromValue(&contained);
}

-- 
Andy Goth
<amgoth at link.com> 




More information about the Qt-interest-old mailing list