[Qt-interest] Checkimg for dirty table model
Stephen Kelly
steveire at gmail.com
Wed Sep 15 13:14:06 CEST 2010
Petric Frank wrote:
> Hello Steven,
>
> Am Dienstag, 14. September 2010, 20:42:53 schrieb Stephen Kelly:
>> Petric Frank wrote:
>> > Do i really have to iterate through all rows and columns to find a
>> > changed (and not committed) field?
>>
>> Having never used that class I can only guess. But it seems you should
>> use submitAll.
>
> That is done afterwards. But how to see if any updates have been done to
> the database (resulting from possibly changed data) ?
>
> submitAll only gives (as i read the docs) only a success/no success info
> in return. But no info whether it was necessary to do any uptdate to the
> database - in other words there was something in the dirty list.
Use the source, Luke.
http://qt.gitorious.org/qt/qt/blobs/4.7/src/sql/models/qsqltablemodel.cpp
It looks like it tries to submit all dirty data, if one of them fails, it
returns false. Otherwise it tries to repopulate the table and returns
whether that worked. That seems to involve resetting the model.
Like I said I've never used that class so I'm not certain of anything it
does. However, it really shouldn't matter to the outside whether calling
submitAll did anything or not. If it does matter you may have some higher
level design issues.
All the best,
Steve.
>
> regards
> Petric
More information about the Qt-interest-old
mailing list