[Qt-interest] removeRow on a derived QSqlTableModel does nothing.
MARTIN Pierre
hickscorp at gmail.com
Wed Sep 28 02:48:03 CEST 2011
Found the solution. It's sort of interesting...
>> i'm trying to understand something. i have derived from QSqlTableModel and am using Sqlite for something very simple.
>> i'm able to insert and update (Via QDataWidgetMappers). However, deletion doesnt work as expected: sometimes it does, and sometimes it just doesn't delete anything.
>> i have tried using manual submit and submitting myself after removeRow(), and i have also tried using automatic submission... The result is the same, i get a very vague error in the lastError object:
>> Failed to delete rows: "Parameter count mismatch"
In the table on which the problematic model is operating, i have a field named "id" which is an auto increment.
In my QSqlTableModel derived model, i call setPrimaryKey(QSqlIndex("id")) in the constructor... if i remove this line, deletion is working again. Any clue of what i'm doing wrong here?
Pierre.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110928/8af5b4a2/attachment.html
More information about the Qt-interest-old
mailing list