title: Q_INVOKABLE method returning custom C++ type
body: <p>I have a C++ method made Q_INVOKABLE. I can call this method from QML and it works when it returns basic types (like QString). But I can't with a custom type. How should I do this? Should I return a QVariant instead? Ideally, I would like to return a pointer to my custom type if possible.</p>
  
  <p><strong>EDIT</strong>
  I do:</p>
  
  <pre><code>qmlRegisterType&lt;MyType&gt;("Mine", 1, 0, "MyType");
  qmlEngine-&gt;rootContext()-&gt;setContextProperty("testObj", new MyType());
  </code></pre>
  
  <p>I can use testObj global object or create MyType QML component. But I cannot use it in some javascript code as a return type from a Q_INVOKABLE C++ method.</p>