QVariant::fromValue() throws error
I cannot wrap my mind why QVariant::fromValue("test");
gives me an error:
C:\Qt\Qt5.0.2\5.0.2\msvc2010_opengl\include\QtCore\qmetatype.h:642: error: C2338: Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system
using QT 5.0.2 and QRCreator 2.7.0
and what should I do to create QVariant from const char*
As you can see in "Documentation":http://qt-project.org/doc/qt-5.0/qtcore/qvariant.html#setValue , the const char * is not a valid value. For this reason a compilation error occurs.
You must only send the value with QVariant("test").
[quote author="francescmm" date="1373040271"]
You must only send the value with QVariant("test").[/quote]
I've tried that already and I got:
error: C2248: 'QVariant::QVariant' : cannot access private member declared in class 'QVariant'
PS. I'm noob in QT, so expect some strange questions.
Could you show the code where you are trying to do that ?
My code is irrelevant, this suppose to be one liner anyways
In my case I've done this:
Seems to be working.
Edit by bad reading... u.u''