It is always best to cast integers to a Qt integer type, such as qint16 or quint32, when reading and writing. This ensures that you always know exactly what size integers you are reading and writing, no matter what the underlying platform and architecture the application happens to be running on.
qint8 |
|
qint16 |
|
qint32 |
|
qint64 |
|
quint8 |
|
quint16 |
|
quint32 |
|
quint64 |
|
float |
- 32-bit floating point number using the standard IEEE 754 format
|
double |
- 64-bit floating point number using the standard IEEE 754 format
|
const char * |
- The string length (quint32)
- The string bytes, excluding the terminating 0
|
QBitArray |
- The array size (quint32)
- The array bits, i.e. (size + 7)/8 bytes
|
QBrush |
- The brush style (quint8)
- The brush color (QColor)
- If style is CustomPattern, the brush pixmap (QPixmap)
|
QByteArray |
- If the byte array is null: 0xFFFFFFFF (quint32)
- Otherwise: the array size (quint32) followed by the array bytes, i.e. size bytes
|
QColor |
- RGB value serialized as a quint32
|
QCursor |
- Shape ID (qint16)
- If shape is BitmapCursor: The bitmap (QPixmap), mask (QPixmap), and hot spot (QPoint)
|
QDate |
|
QDateTime |
|
QFont |
- The family (QString)
- The point size (qint16)
- The style hint (quint8)
- The char set (quint8)
- The weight (quint8)
- The font bits (quint8)
|
QHash<Key, T> |
- The number of items (quint32)
- For all items, the key (Key) and value (T)
|
QImage |
- If the image is null a "null image" marker is saved; otherwise the image is saved in PNG or BMP format (depending on the stream version). If you want control of the format, stream the image into a QBuffer (using QImageIO) and stream that.
|
QKeySequence |
- A QList<int>, where each integer is a key in the key sequence
|
QLinkedList<T> |
- The number of items (quint32)
- The items (T)
|
QList<T> |
- The number of items (quint32)
- The items (T)
|
QMap<Key, T> |
- The number of items (quint32)
- For all items, the key (Key) and value (T)
|
QMatrix |
- m11 (double)
- m12 (double)
- m21 (double)
- m22 (double)
- dx (double)
- dy (double)
|
QPair<T1, T2> |
|
QPalette | The disabled, active, and inactive color groups, each of which consists of the following:
|
QPen |
- The pen styles (quint8)
- The pen width (quint16)
- The pen color (QColor)
|
QPicture |
- The size of the picture data (quint32)
- The raw bytes of picture data (char)
|
QPixmap |
|
QPoint |
- The x coordinate (qint32)
- The y coordinate (qint32)
|
QRect |
- left (qint32)
- top (qint32)
- right (qint32)
- bottom (qint32)
|
QRegion |
- The size of the data, i.e. 8 + 16 * (number of rectangles) (quint32)
- 10 (qint32)
- The number of rectangles (quint32)
- The rectangles in sequential order (QRect)
|
QSize |
- width (qint32)
- height (qint32)
|
QString |
- If the string is null: 0xFFFFFFFF (quint32)
- Otherwise: The string length in bytes (quint32) followed by the data in UTF-16
|
QTime |
- Milliseconds since midnight (quint32)
|
QVariant |
- The type of the data (quint32)
- The data of the specified type
|
QVector<T> |
- The number of items (quint32)
- The items (T)
|