Is this also possible for keys in a QHash for example?

> Am 21.11.2015 um 05:26 schrieb Thiago Macieira <thiago.macie...@intel.com>:
> 
>> On Saturday 21 November 2015 03:08:54 Tom Isaacson wrote:
>> I'm moving an old project to Qt5 and since we've upgraded compiler and now
>> have C++11 support I thought I'd change my enums to "enum class". This
>> breaks some code where I add the enum to a QVariantMap in preparation to
>> conversion to JSON so I had to add a static_cast<int>(). But it made me
>> wonder - is this best practice or is there a Qt way of declaring a
>> strongly-typed enum that's compatible with the likes of QVariant?
> 
> Strongly-typed enums need to be used as a completely separate type. You need 
> to declare them as metatypes, load them into a QVariant using 
> QVairant::fromValue and retrieve using qvariant_cast<EnumType>().
> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center
> 
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to