In a huge true (multi-level) treeview implemented with Qt4 QTreeView and a QAbstractItemModel, we need a way of showing an "item" row (QModelIndex) as EXPANDABLE (with a treeview item control) before our model has instantiated internal structures for child "items". We would populate the model with a top-level item's child "items" only when the user expands that top-level item.

This was supported with Qt3's Q3ListViewItem's "expandable" flag:

  • void Q3ListViewItem::setExpandable ( bool enable )
  • bool Q3ListViewItem::isExpandable () const

Neither Qt4's QTreeView nor QAbstractItemModel support this property on a per QModelIndex (or "row") basis. The Qt4 QTreeView does have an "itemsExpandable" boolean property -- but that's for the overall treeview.

Is there a way of showing QTreeView "items" as expandable before actually having child "items" (within our QAbstractItemModel implementation)?

Thank you in advance.
Phil Weinstein, CADSWES
University of Colorado, USA