... case QMetaType::Float: *str = QString::number(d->data.f, 'g', FLT_DIG); break; case QVariant::Double: *str = QString::number(d->data.d, 'g', DBL_DIG); break;...
QVariant var_data; ... QString str_data; if (var_data.type() == QVariant::Double) str_data = QLocale().toString(var_data.toDouble()); else str_data = var_data.toString();