On Wednesday 16 July 2014 10:06:52 Poenitz Andre wrote: > Jędrzej Nowacki wrote: > > Eike wrote: > > > [...] > > > > > >>> We use common sense on a case by case basic. > > > > > > Either there is no “common sense” common to me, or this rule has failed > > > in > > > the past already ;) > > > bool -> string ? > > > bytearray -> int/long/double ? > > > keysequence -> int ? > > > string -> bool ? > > > string -> bytearray ? > > > string -> int ? > > > > What is wrong with string -> int or bytearray -> int? > > At the very least, _implicit_ conversions should not lose data, > i.e. a A a1; B b = a1; A a2 = b; round trip ideally should yield > a1 == a2. > > If I am ready to give up information, I'd like to need to say so > in the code explicitly. (And yes, part of the deed is done in the > core language, but even there compilers start to nag about it.)
André, QVariant conversions are not implicit, they are explicit. You have to use qvariant_cast<T>, QVariant::value<T>, or QVariant::to*. That's explicit. Conversions _to_ QVariant are sometimes implicit, but they are loss-less as it just wrap the type into the QVariant. -- Olivier Woboq - Qt services and support - http://woboq.com - http://code.woboq.org _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development