QSqlRelationalTableModel & QListView
I want to set a QListView's model to QSqlRelationalTableModel and set every column of a row on the model to the QListView's index's data and when the database gets updated the index's data must be updated as well. for example:
I have a QSqlRelationalTableModel with this information:
row1 rc11 rc12
row2 rc21 rc22
I want the view to view this:
row1: rc11 //Qt::DisplayRole
row2: rc21 //Qt::DisplayRole
the database holds tags of a music file and I want to show them in a listView
Can anyone help me?
thanks in advance
You can use a proxy model where you assemble the content of both columns.
Does the proxy model like QSqlRelationalTableModel interact with sqlite database and gets updated when the db is updated?
What kind of update are you thinking about ?
when sometihng is inserted in the db li QSqlRelationalModel
So when you update the database content throughout the models ?
Throughout the model or a query
The most simple is to do it through the model. That will trigger everything needed to update the view.