Hi,
how to store an custom enum with QSettings and restore it?
Qt Code:
myClass::myEnum m_enum = settings.value("xxx").value<myClass::myEnum>(); // fails because no Qt-classTo copy to clipboard, switch view to plain text mode
Thanks
Lykurg
Hi,
how to store an custom enum with QSettings and restore it?
Qt Code:
myClass::myEnum m_enum = settings.value("xxx").value<myClass::myEnum>(); // fails because no Qt-classTo copy to clipboard, switch view to plain text mode
Thanks
Lykurg
There are a few choices... The simplest is to cast your enum to int (and vice versa). If you need something more complicated, you can use Qt object introspection to map from your enum to QString - there even is a thread that discusses this in this forum. Remember, that if you want to use your custom type with QVariant directly, you have to first register it with the meta-type system. It's described in QVariant docs.
Lykurg (15th March 2007)
Bookmarks