I have a QSqlTableModel that works to view/update a table in mysql. If I make a view of the table then it will display the data but edits fail. I can update the table with a mysql update so the view is updateable.
I think what is happening is that since the view does not have a primary key the primary key for the QSqlTableModel is not set and it won't update.
I can't find any examples how to set the primary key. The setPrimaryKey() of QSqlTableModel is protected. I am sure I am missing something fundamental but searching returns a lot of results for view in the context of MVC.
Can anyone point me to an example of how to call setPrimaryKey or an example of using a QSqlTableModel to update a database view in mysql?
I am thinking now that this is not going to work like I want it to anyway. I could probably make it work for a view with a single table but it would likely be too much work to make it behave properly if I have a view with multiple tables. It would be better to take a different approach.