Implementation of QAbstractItemModel for tree-like data structures