Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. error: ‘QVariant::QVariant(void*)’ is private inline QVariant(void *) Q_DECL_EQ_DELETE;

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 3.1k Views
  • 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_DN Offline
    Naveen_DN Offline
    Naveen_D
    wrote on last edited by
    #1

    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
    0
    • jpnurmiJ Offline
      jpnurmiJ Offline
      jpnurmi
      wrote on last edited by
      #2

      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
      0

      • Login

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