Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved error: ‘QVariant::QVariant(void*)’ is private inline QVariant(void *) Q_DECL_EQ_DELETE;

    QML and Qt Quick
    2
    2
    2532
    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.
    • Naveen_D
      Naveen_D last edited by

      Hi all

      I am trying to use C++ class in qml using setcontext property method, but when i try to build it it is giving the following error

      /opt/Qt5.8.0/5.8/gcc_64/include/QtCore/qvariant.h:471: error: ‘QVariant::QVariant(void*)’ is private
      inline QVariant(void *) Q_DECL_EQ_DELETE;

      what may be the issue for this? what changes i need to make ?

      thanks

      Naveen_D

      1 Reply Last reply Reply Quote 0
      • jpnurmi
        jpnurmi last edited by

        You are trying to convert a pointer to a QVariant. You'll have to use QVariant::fromValue() to avoid implicit cast to bool and end up using QVariant(bool).

        T *ptr = ...;
        QVariant v1 = ptr; // not ok
        QVariant v2 = QVariant::fromValue(ptr); // ok
        
        1 Reply Last reply Reply Quote 0
        • jpnurmi
          jpnurmi last edited by

          You are trying to convert a pointer to a QVariant. You'll have to use QVariant::fromValue() to avoid implicit cast to bool and end up using QVariant(bool).

          T *ptr = ...;
          QVariant v1 = ptr; // not ok
          QVariant v2 = QVariant::fromValue(ptr); // ok
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post