[Development] Should QVariant be doing fuzzy comparisons on doubles?

Sune Vuorela nospam at vuorela.dk
Fri Sep 23 21:10:40 CEST 2016


On 2016-09-23, André Pönitz <apoenitz at t-online.de> wrote:
> That gives already "surprising" behaviour if fed with QChar('a') and
> QString("a") in a row.
>
> And it is "surprising" to a degree that I'd call it buggy.

Then try feeding it boolean's and strings.

QQmlPropertyMap map;
map.insert(QLatin1String("key1"),true);
map.insert(QLatin1String("key1"),QLatin1String("p"));
QCOMPARE(map.value(QLatin1String("key1")).toString(),QLatin1String("p"));
QCOMPARE((int)map.value(QLatin1String("key1")).type(),(int)QMetaType::QString);
map.insert(QLatin1String("key1"),false);
map.insert(QLatin1String("key1"),QLatin1String(""));
QCOMPARE((int)map.value(QLatin1String("key1")).type(),(int)QMetaType::QString);

(Taken from https://codereview.qt-project.org/#/c/121715/1//ALL when I
was trying to fix things but ... kind of moved on)

/Sune




More information about the Development mailing list