[Qt-interest] QVariant::save: unable to save type X

Josiah Bryan jbryan at productiveconcepts.com
Wed Jun 9 17:00:35 CEST 2010


I'm probably misusing or misunderstanding something here. Basically, 
I've got a class with a public enum (FillType) that is used as a 
Q_PROPERTY. Great - works fine. However, when writing that property to a 
QVariantMap and writing the map to a QDataStream, I get the following 
warning. (Self-contained  50-line example program of this problem attached.)

    QVariant::save: unable to save type 258.

And the resulting variant, while having the correct type, lacks the 
correct value:

    QMap(("fillType", QVariant(AbstractVisualItem::FillType, ) ) )

The odd thing is, if I comment out the following line (line 31 in the 
attached source):

    
qRegisterMetaType<AbstractVisualItem::FillType>("AbstractVisualItem::FillType");

It works perfectly! No warning, the variant saves the value for the enum 
- it's all kittens and sparkles.

So, am I misusing qRegisterMetaType or is this a bug?  A one word answer 
saying something like, "misusing" is just fine - I just want to know if 
I'm wrong or right.

Thanks!
-Josiah

-- 

-=-=-=-=-=-=-=-=-=-=-=-=-
Josiah Bryan
Productive Concepts, Inc.
jbryan at pciint.com
(765) 964-6009, ext. 224

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 1084 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100609/19df9d72/attachment.bin 


More information about the Qt-interest-old mailing list