Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Qt6: create QVariant with specific QMetaType

    General and Desktop
    qt6 qvariant qmetatype
    1
    1
    81
    Loading More Posts
    • 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.
    • V
      voltron last edited by

      I'm porting an app from Qt5 to Qt6. This app heavily uses QVariants and one of the use-cases is creating invalid QVariant with the specific QVariant::Type, for example

      return QVariant( QVariant::Double );
      

      In Qt6 QVariant::Type was replaced with QMetaType::Type, but when I make corresponding changes in the code

      return QVariant( QMetaType::Double );
      

      I get following error

      error: use of deleted function ‘QVariant::QVariant(QMetaType::Type)’
      

      According to the docs such constructor still exists, so I'm a bit lost what is wrong and how to fix this error.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post