title: How to efficiently expose many C++ data members of a single object to QML?
body: <p>I have a C++ object pointer with many data members. I need them all available in QML. One obvious way would be to create a <code>Q_PROPERTY</code> for each member so they can be individually accessed via QML. However, if we are talking about dozens of data members, well that's a lot of lines of <code>Q_PROPERTY</code>, not to mention having to individually handle these in QML as separate properties as well (especially if dealing with "on changed" signals for each property).</p>
  
  <p>I am wondering if it is possible to make a single <code>Q_PROPERTY</code> that would include all the data members I need. But what is not clear to me is the apparent mismatch between <a href="http://qt-project.org/doc/qt-4.8/qdeclarativebasictypes.html" rel="noreferrer">the types that QML supports</a> and the types you can list in a <code>Q_PROPERTY</code>. For example, in QML, we have a basic <code>string</code> but its corresponding lising in a C++ <code>Q_PROPERTY</code> must be <code>QString</code>:</p>
  
  <pre><code> Q_PROPERTY(QString datastring READ showdata NOTIFY datastringChanged)
    //in QML, `datastring` is just a plain string
  </code></pre>
  
  <p>Would there be more complex properties like lists or arrays that can be easily matched? QML has a <code>list</code> type and C++ has the <code>QList</code> but are these the same thing? Where can I find a listing of compatible types between C++ and QML?</p>
  
  <p>On the other hand, having individual Q_PROPERTY for each data member could likely be better performance (my data is large and often changing) since the QML would not need to parse anything, perhaps. </p>