I have several SQL table models. Each has column representing a primary key, foreign key pointing to parent's primary key (optional for 1st level table), and some text data. I want to display these in a QTreeView. I must admit that rolling my own from QAbstractItemModel has me stumped.

I have looked at the TransposeProxyModel example, but it assumes one if going from table to table. No tree representation.

My best try, so far, has been starting with Editable Tree Model, and changing the stored data in each TreeItem to be a sourceIndex instead of a stored value. I break down when trying to connect my source rowsInserted signal and have it call my insertRows in a private slot.

Does anyone know of a good example of taking SQL data and displaying it in a QTreeView?
Something that would update robustly if the source models changed.
I would accept read-only (no editing).
I am not against moving down to QSqlQueryModel for the underlying models, but would like to stick with QSqlTableModel, if possible.
I would even accept a flat LEFT JOIN representation underneath, if need be.