QVariantValue QT_DEPRECATED_SINCE(5, 0) legacy code

  • i need to convert Qt legacy code from 4 to 5.1
    now i have compilation error in visual studio 2010 :

    @ SingleItem* item = qVariantValue<SingleItem*>(index.data()); @

    gives me :

    @ .cpp(63): error C2065: 'qVariantValue' : undeclared identifier@

    when i go to the header i see :

    @ #if QT_DEPRECATED_SINCE(5, 0)
    template<typename T>
    inline QT_DEPRECATED T qVariantValue(const QVariant &variant)
    { return qvariant_cast<T>(variant); }

    template<typename T>
    inline QT_DEPRECATED bool qVariantCanConvert(const QVariant &variant)
    { return variant.template canConvert<T>(); }


    ok ... so what is the replacement?

  • Moderators

    There's a "QVariant::value()":http://qt-project.org/doc/qt-5.0/qtcore/qvariant.html#value member.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.