Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QVariantValue QT_DEPRECATED_SINCE(5, 0) legacy code
Forum Updated to NodeBB v4.3 + New Features

QVariantValue QT_DEPRECATED_SINCE(5, 0) legacy code

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    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>(); }
    #endif
    

    @

    ok ... so what is the replacement?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved