C++ (Qt)qreal x = 0;QVariant v = x;switch (v.type()) {case QVariant::Double: qDebug("x=%f", v.toDouble()); break;default: Q_ASSERT(false);}