diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 1e72321ff2..fa8bc16fb4 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1759,14 +1759,14 @@ QBitArray QVariant::toBitArray() const } template -inline T qNumVariantToHelper(const QVariant::Private &d, bool *ok, const T& val) +inline T qNumVariantToHelper(const QVariant::Private &d, bool *ok) { QMetaType t = QMetaType::fromType(); if (ok) *ok = true; if (d.type() == t) - return val; + return d.get(); T ret = 0; bool success = QMetaType::convert(d.type(), d.storage(), t, &ret); @@ -1794,7 +1794,7 @@ inline T qNumVariantToHelper(const QVariant::Private &d, bool *ok, const T& val) */ int QVariant::toInt(bool *ok) const { - return qNumVariantToHelper(d, ok, d.get()); + return qNumVariantToHelper(d, ok); } /*! @@ -1816,7 +1816,7 @@ int QVariant::toInt(bool *ok) const */ uint QVariant::toUInt(bool *ok) const { - return qNumVariantToHelper(d, ok, d.get()); + return qNumVariantToHelper(d, ok); } /*! @@ -1833,7 +1833,7 @@ uint QVariant::toUInt(bool *ok) const */ qlonglong QVariant::toLongLong(bool *ok) const { - return qNumVariantToHelper(d, ok, d.get()); + return qNumVariantToHelper(d, ok); } /*! @@ -1850,7 +1850,7 @@ qlonglong QVariant::toLongLong(bool *ok) const */ qulonglong QVariant::toULongLong(bool *ok) const { - return qNumVariantToHelper(d, ok, d.get()); + return qNumVariantToHelper(d, ok); } /*! @@ -1890,7 +1890,7 @@ bool QVariant::toBool() const */ double QVariant::toDouble(bool *ok) const { - return qNumVariantToHelper(d, ok, d.get()); + return qNumVariantToHelper(d, ok); } /*! @@ -1909,7 +1909,7 @@ double QVariant::toDouble(bool *ok) const */ float QVariant::toFloat(bool *ok) const { - return qNumVariantToHelper(d, ok, d.get()); + return qNumVariantToHelper(d, ok); } /*! @@ -1928,7 +1928,7 @@ float QVariant::toFloat(bool *ok) const */ qreal QVariant::toReal(bool *ok) const { - return qNumVariantToHelper(d, ok, d.get()); + return qNumVariantToHelper(d, ok); } /*!