PDA

View Full Version : Refreshing QDataTable



zlatko
2nd May 2006, 13:42
Hi all!
Can i refresh only changed records of QDataTable? :rolleyes:

jacek
2nd May 2006, 14:41
How would you find out whether the record was changed?

zlatko
2nd May 2006, 15:00
I mean changing that user do own by editing some record in data table..

Ok i think my question has poor info for good understanding. I'll try correct that :)
So i have read only data table with 1000 records. For editing record i create new dialog, and after user press "Ok" i do dataTable->refresh(). I want refresh only some edited cell , but i see that my data table has full refresh :eek: The same thing hapend when i add or delete row..What i missed :confused:

jacek
2nd May 2006, 15:32
Do you use QSqlSelectCursor with this QDataTable?

zlatko
2nd May 2006, 15:43
yes..........

jacek
2nd May 2006, 16:11
Well... you can't do this directly because QSqlSelectCursor is read-only, but QDataTable inherits QTable, so you could try to hack it using QTable methods or you can implement your own QSqlCursor subclass.

Another solution is to use QTable and fill it with data by hand.

Anyway, if your program uses a database, then probably more than one person will be using it at the same time. In such case you would want to refresh the data from time to time, so a refresh after adding a record won't be so bad (unless you have a really complex query).