[Development] RFC: Improved Q_ENUM

Thiago Macieira thiago.macieira at intel.com
Wed Feb 18 18:14:18 CET 2015


On Wednesday 18 February 2015 17:44:05 Olivier Goffart wrote:
> On Wednesday 18 February 2015 11:25:54 Matthew Woehlke wrote:
> > Sorry to jump in so late, but... *THIS IS AWESOME!* Converting enums to
> > strings and vice versa is very common, but I'm not aware of a generic
> > solution to the problem until now. (Yes, bidirectional; as mentioned,
> > use in settings, UI, file export etc. are all existing non-debug uses.
> > Not that the QDebug support isn't killer by itself :-).)
> > 
> > I have two questions, though:
> > 
> > 1. How does this interact with QSettings? If I directly pass an enum to
> > e.g. QSettings::setValue, is it written as an int or an enum (I guess
> > int)? What about if I use QVariant::fromValue (i.e. so the variant type
> > is the enum)?
> 
> I have not tried QSettings yet, but since it works with QVariant it should
> work.

But if already worked, this means the new file format will be different than 
what it used to. We may actually have to keep the current format so old 
applications can read the settings file produced by new applications.

That brings the question: does QDataStream format change?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list