title: Differentiate between QML array and map/object types from C++
body: <p>Consider QML such as:</p>
  
  <pre><code>Item {
    objectName: "myitem"
  
    // arrays  
    property var arr1: [1,2,3]
    property var arr2: ['a','b','c']
    property var arr3: [{'a':1,'b':2},{},{}]
  
    // maps/objects
    property var map1: {'a':1,'b':2}
    property var map2: {'l1':[1,2,3], 'l2':[4,5,6]}
  }
  </code></pre>
  
  <p>How can I determine if a property (by name) is a list or a map from C++?</p>
  
  <p>For example:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>QObject* item = root-&gt;findChild&lt;QObject*&gt;("myitem");
  QVariant value = item-&gt;property(propName);
  bool isList = value.canConvert&lt;QVariantList&gt;();
  bool isMap = value.canConvert&lt;QVariantMap&gt;();
  </code></pre>
  
  <p>gives true for <code>isList</code> and <code>isMap</code> for all of those properties.</p>
  
  <p>The <code>value.type()</code> doesn't seem to be of much help either (just gives 1024 in both cases - <code>QMetaType::User</code>).</p>
  
  <p>I don't know in advance the type of the QML property.</p>
  
  <p>Also: if I use Javascript to assign the properties from arrays and objects within Javascript code, will the types be the same as the statically specified QML literals above?</p>
  
  <p>Is <code>QJSValue</code> of any use here?</p>
  
  <p>FYI: I am interfacing with another type system that also represents simple types, and arrays and maps of them, and I wish to dynamically convert to/from QML array &amp; map properties.  Including nested arrays of maps and maps with array values etc. (though map keys are always strings).</p>