QSqlRelationalTableModel and Delegates when implementin a Many-to-many (data model)
I'm having some problems understanding how to implement a Many-to-many relation using Qt and MySql, and this is why i'm building this small example ( "here ":https://app.box.com/s/d4pvg4e876x47tstspxc).
In theory, i will need to create a cross-reference table ( "wikipedia ...":http://en.wikipedia.org/wiki/Many-to-many_(data_model) ).
This is my database model:
All working fine with tables A and B.
When it comes to the dialog that manages the "AB" table, things are not looking good .
*Problem 1: *
When i updade data in tables A or B, after updating the model in the AB Dialog, the delegates still show the old info in the AB Dialog. Is there a way to update this without closing and reopening the dialog?
Deleting a record fails with this code:
QModelIndex index = view->currentIndex();
qDebug() << "Error ...";
Insert works in the end, after updating the model, but the editing fase still very messy.
There are other issues here but, for the moment, i just want to know if i'm missing something really obvious regarding the use o QSqlRelationalModel and delegates!
Any help appreciated.
Does anyone know an example, similar to this, so that i can take a look?