title: How to register the following datatype to allow serialization?
body: <p>I am using <a href="http://qjson.sourceforge.net/" rel="nofollow">QJson</a> to serialize a <code>QObject</code>-derived class. I am able to serialize the class itself without any problems, but when it comes to one of its members, I am having a bit of trouble.</p>
  
  <p>The class is named <code>CProject</code> and it contains a property <code>files</code> which is defined as:</p>
  
  <pre><code>QList&lt;CProjectFile&gt; files;
  </code></pre>
  
  <p>When serializing an instance of <code>CProject</code>, I get a message in the console:</p>
  
  <blockquote>
    <p><code>QMetaProperty::read: Unable to handle unregistered datatype 'QList&lt;CProjectFile&gt;' for property 'CProject::files'</code></p>
  </blockquote>
  
  <p>I read somewhere that I have to register the datatype, so I added the following after the declaration of <code>CProject</code>:</p>
  
  <pre><code>Q_DECLARE_METATYPE(QList&lt;CProjectFile&gt;)
  </code></pre>
  
  <p>...and when that did nothing, I added:</p>
  
  <pre><code>qRegisterMetaType&lt; QList&lt;CProjectFile&gt; &gt;();
  </code></pre>
  
  <p>Nothing is working. What am I doing wrong?</p>