hello ppl,

i'd like to visualize the contents of a small DB in a QTreeView.

the data in the database looks like the following example:

tbl_artist (ID INTEGER, NAME VARCHAR); ID is primary key
tbl_cd (ID INTEGER, NAME VARCHAR, ID_ARTIST); ID is primary key, ID_ARTIST foreing key

displaying this realation with a QSqlRelationalTableModel is pretty simple and would generally look like:
Qt Code:
  1. //we're inside a QWidget or QDialog or etc.
  2. createDbConnection();
  3. relModel = new QSqlRelationalTableModel(this);
  4.  
  5. relModel->setTable("tbl_cd");
  6. relModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
  7. relModel->setRelation(2, QSqlRelation("tbl_artist", "ID", "NAME"));
  8. model->select();
  9.  
  10. m_tableView->setModel(relModel);
To copy to clipboard, switch view to plain text mode 

i don't like the visualisation of the date inside a QTableView and would prefer the data to be arranged inside a QTreeview that would look like:

|
-artist1
| |-cd1
| |-cd2
|
-artist2
| |-cd1

..... i hope you get what i would like...

what i discovered so far is, that i have to use a QProxyModel to achieve it.
i searched the net and diverse forums to get an idea of how to use the QProxyModel, but found nothing that helped me further

i hope somebody here has the knowledge of how to link the 2 models.
i'd appreciate any help or suggestions.

greets
darksaga