Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It turns out that there's a very simple reason that the <code>count</code> property of the <code>cppModel</code> isn't available - it's because neither <code>QAbstractListModel</code> nor <code>QList&lt;&gt;</code> have a <code>count</code> property!</p> <p>I had assumed that the fact that a <code>ListModel</code> could be substituted with a C++-based object like a QList&lt;> meant that they were polymorphic and that a ListView or PathView would use a <code>count</code> property to correctly handle them. </p> <p>First, neither <code>QAbstractListModel</code> nor <code>QList&lt;&gt;</code> are polymorphic with a <code>ListModel</code>. It turns out that they're all just special-cased - a <code>ListView</code> knows whether it has a <code>ListModel</code> or a <code>QList&lt;&gt;</code> or a <code>QAbstractListModel</code> and has separate code paths for using each. The <code>ListView</code> doesn't need the nonexistent <code>count</code> property to manage a <code>QList&lt;&gt;</code> or a <code>QAbstractListModel</code>. In fact, it isn't clear to me that <code>ListView</code> and <code>PathView</code> even use <code>ListModel</code>'s <code>count</code> property. The <code>count</code> property seems to be mostly for the QML programmer's benefit. In my example, I was using the <code>count</code> property to build a <code>Path</code> object in the <code>PathView</code>. My example works perfectly if I use a <code>length</code> property instead because <code>QList&lt;&gt;</code> DOES have a <code>length</code> property.</p> <p>Thanks to blam and torgeirl on #qt-qml for helping me with this (neither wanted to collect the stackoverflow points by posting this answer, so I'm posting it for the benefit of the community).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload