title: Qt how to extract custom data pointer from QVariant without knowing the internal type
body: <p>I have a <code>QVariantMap</code> with data. Inside the <code>QVariant</code> I can store <strong>custom class</strong> declared and registered in meta-system.</p>
  
  <p>I know does exists  <code>QVariant::value&lt;XXX&gt;()</code> but since i don't know a-priori what <code>XXX</code> is I cannot do that.</p>
  
  <p>So I tried to convert to <code>QObject*</code> both with <code>QVariant::value&lt;QObject*&gt;</code> and <code>qvariant_cast</code> but it seems to hold a void pointer:</p>
  
  <p>My attempt:</p>
  
  <pre><code>MyClass* obj = new MyClass();
  QVariant variant = QVariant::fromValue&lt;MyClass*&gt;(obj);  // it works;
  
  qDebug() &lt;&lt; variant; // Qvariant(MyClass*,)
  
  QObject* obj2 = variant.value&lt;QObject*&gt;();
  
  qDebug() &lt;&lt; obj2; // QObject(0x0)
  </code></pre>