[Qt-interest] QDataStream backwards incompatibility introduced in 4.6
Lene Preuss
lene.preuss at googlemail.com
Thu Jan 21 11:54:49 CET 2010
On 01/21/10 10:50, Lene Preuss wrote:
> The QDataStream class changed the way it stores floats from 4.5 to 4.6.
> Floats written with Qt prior to 4.6 are not read correctly with 4.6.
>
More specifically, as pointed out in
http://doc.qt.nokia.com/4.6/qdatastream.html#setFloatingPointPrecision,
floats are by default stored and read as doubles now. Before 4.6 the
format of a floating point variable depended on overloaded version of
operator<< or operator>>.
To read floats from files written with a QDataStream from an older Qt,
you could either call stream.setVersion(11) or
stream.setFloatingPointPrecision(QDataStream::SinglePrecision) before
using the stream.
More information about the Qt-interest-old
mailing list