sql - Problem with QSqlTableModel -- no automatic updates -
After setting up the table model in QT 4.4:
QSqlTableModel * sqlmodel = new QSqlTableModel (); Sqlmodel- & gt; Settable ("name"); Sqlmodel- & gt; SetEditStrategy (QSqlTableModel :: OnFieldChange); Sqlmodel- & gt; Selection (); Sqlmodel- & gt; RemoveColumn (0); TableView-> SetModel (sqlmodel); TableView-> Show ();
The content is displayed properly, but editing is not possible, error:
QSqlQuery :: value: is not located on a valid record
I can confirm that the bug is actually ok as you report it to 4.5.1 Documentation, such as, still gives an incorrect example (i.e., deleted columns
calls).
Around the one hand I before the update
sign, which is incorrect with QSqlRecord, which can be updated in DB and possibly fixing the idea of fixing it. Along, but I can not get it to work - a call for the methods of that record parameter is crashing my toy-app with a BusError.
So I left that idea and there is no doubt what is the correct way to do it (visibility should be determined by the scene, not by model, right? -): Delete column
and call tableView-> setColumnHidden (0, true)
in return. In this way the ID ID is hidden and everything works.
So I think we can confirm that there is a documentation error and it opens an issue in Qt Tracker about it, so it can be fixed in the next documents, right?
Comments
Post a Comment