QSqlRelationalTableModel & QListView
-
Hi,
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:
column1 column2
row1 rc11 rc12
row2 rc21 rc22I want the view to view this:
row1: rc11 //Qt::DisplayRole
rc12 //Qt::UserRole+!row2: rc21 //Qt::DisplayRole
rc22 //Qt::UserRole+!the database holds tags of a music file and I want to show them in a listView
Can anyone help me?thanks in advance
-
Hi,
You can use a proxy model where you assemble the content of both columns.
-
Hi @SGaist
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 ?
-
Hi @SGaist
when sometihng is inserted in the db li QSqlRelationalModel -
So when you update the database content throughout the models ?
-
Hi, @SGaist
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.