On 2010-06-05, Vadym Honcharuk wrote:
> Thanks a lot, Mark!
Hi Vadym,
One approach that you could take is to write the count of how many
things you're going to write and then write the things. For example,
you could try something like this:
write data:
srcCount = self.srcTableModel.count()
stream.writeInt32(srcCount) # NEW
for row in range(srcCount):
# write the row as before
frmCount = self.frmTableModel.count()
stream.writeInt32(frmCount) # NEW
for row in range(frmCount):
# write the inner row as before
read data:
self.srcTableModel.ships = []
self.frmTableModel.ships = []
srcCount = stream.readInt32() # NEW
for srcRow in range(srcCount):
if stream.atEnd():
# handle error
equipment = QtCore.QString()
stream >> equipment
srcCode = stream.readInt32()
srcName = QtCore.QString()
stream >> srcName
self.srcTableModel.ships.append(srcShip(equipment, srcCode,
srcName))
frmCount = stream.readInt32() # NEW
for frmRow in range(frmCount):
if stream.atEnd():
# handle error
formationSrcName = QtCore.QString()
stream >> formationSrcName
evolvingGasDepletion = stream.readInt32()
evolvingGasTemperature = stream.readInt32()
...
[snip]
I hope this helps!
--
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"C++ GUI Programming with Qt 4" - ISBN 0132354160
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt