I'm trying to store QSharedPointer<MyClass> values in a QVariant (so i can store it as custom data in a QComboBox) using:
MyClass* myIns = new MyClass();
QSharedPointer<MyClass> asp(myIns);
MyClass* myIns = new MyClass();
QSharedPointer<MyClass> asp(myIns);
QVariant aVariant = QVariant::fromValue(asp);
To copy to clipboard, switch view to plain text mode
how do i retrieve the QSharedPointer<MyClass> back from aVariant ?
i tried:
QSharedPointer<MyClass> retValue = v.value<QSharedPointer<MyClass> >();
QSharedPointer<MyClass> retValue = v.value<QSharedPointer<MyClass> >();
To copy to clipboard, switch view to plain text mode
but the compiler doesn't like that.
note: MyClass is derived of QObject
Bookmarks