Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.9.0 Beta 4
-
None
Description
This bug is an update for QTBUG-52097.
On 5.9, QVariant::toJsonValue() works for Q... types but not for C number types (int ...).
The actual implementation in qvariant.cpp call qVariantToHelper:
QJsonValue QVariant::toJsonValue() const { return qVariantToHelper<QJsonValue>(d, handlerManager); }
but all the methods like toInt call qNumVariantToHelper instead :
int QVariant::toInt(bool *ok) const { return qNumVariantToHelper<int>(d, handlerManager, ok, d.data.i); }
There is thus two flavours of q...VariantToHelper !
As a workaround, we have to use QJsonValue::fromVariant() but the API could be more consistent.