[PyQt] Master-detail relationship with plain QTableView tables (no SQL database)
list at qtrac.plus.com
Sun Jun 6 07:42:17 BST 2010
On 2010-06-05, Vadym Honcharuk wrote:
> works excellent! Thanks a lot!
> one question almost on this issue: only one QDataStream may exist per
> one file? May be one more approach is separate QDataStream for each
> tables and in one file?
Yes, only *one* QDataStream per file!
If you wanted to handle the tables separately then one possible approach
would be to do something along these lines:
open a QDataStream on a QBuffer for table #1
open another QDataStream on another QBuffer for table #2
write the data but this time to each table's associated buffer
once the buffers have been written to, close them and then open a
QDataStream to the file & write the buffers to the file one after
and reverse for reading
However, this is more complicated and means that you store the entire
file's worth of data in memory (in addition to the data in the tables)
at once, so I prefer writing to the file directly using a single
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Advanced Qt Programming" - ISBN 0321635906
More information about the PyQt