Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 99

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- datastreamformat.qdoc -->
  <title>Serializing Qt Data Types | Qt Core 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtcore-index.html">Qt Core</a></td><td >Serializing Qt Data Types</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Serializing Qt Data Types</h1>
<span class="subtitle"></span>
<!-- $$$datastreamformat.html-description -->
<div class="descr"> <a name="details"></a>
<p>The <a href="qdatastream.html">QDataStream</a> allows you to serialize some of the Qt data types. The table below lists the data types that <a href="qdatastream.html">QDataStream</a> can serialize and how they are represented. The format described below is <a href="qdatastream.html#setVersion">version 13</a>.</p>
<p>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.</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td >bool</td><td ><ul>
<li>boolean</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td >qint8</td><td ><ul>
<li>signed byte</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td >qint16</td><td ><ul>
<li>signed 16-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td >qint32</td><td ><ul>
<li>signed 32-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td >qint64</td><td ><ul>
<li>signed 64-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td >quint8</td><td ><ul>
<li>unsigned byte</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td >quint16</td><td ><ul>
<li>unsigned 16-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td >quint32</td><td ><ul>
<li>unsigned 32-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td >quint64</td><td ><ul>
<li>unsigned 64-bit integer</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><code>float</code></td><td ><ul>
<li>32-bit floating point number using the standard IEEE 754 format</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><code>double</code></td><td ><ul>
<li>64-bit floating point number using the standard IEEE 754 format</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><code>const char *</code></td><td ><ul>
<li>The string length (quint32)</li>
<li>The string bytes, excluding the terminating 0</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qbitarray.html">QBitArray</a></td><td ><ul>
<li>The array size (quint32)</li>
<li>The array bits, i.e&#x2e; (size + 7)/8 bytes</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="../qtgui/qbrush.html">QBrush</a></td><td ><ul>
<li>The brush style (quint8)</li>
<li>The brush color (<a href="../qtgui/qcolor.html">QColor</a>)</li>
<li>If style is CustomPattern, the brush pixmap (<a href="../qtgui/qpixmap.html">QPixmap</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qbytearray.html">QByteArray</a></td><td ><ul>
<li>If the byte array is null: 0xFFFFFFFF (quint32)</li>
<li>Otherwise: the array size (quint32) followed by the array bytes, i.e&#x2e; size bytes</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="../qtgui/qcolor.html">QColor</a></td><td ><ul>
<li>Color spec (qint8)</li>
<li>Alpha value (quint16)</li>
<li>Red value (quint16)</li>
<li>Green value (quint16)</li>
<li>Blue value (quint16)</li>
<li>Pad value (quint16)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtgui/qcursor.html">QCursor</a></td><td ><ul>
<li>Shape ID (qint16)</li>
<li>If shape is BitmapCursor: The bitmap (<a href="../qtgui/qpixmap.html">QPixmap</a>), mask (<a href="../qtgui/qpixmap.html">QPixmap</a>), and hot spot (<a href="qpoint.html">QPoint</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qdate.html">QDate</a></td><td ><ul>
<li>Julian day (quint32)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qdatetime.html">QDateTime</a></td><td ><ul>
<li>Date (<a href="qdate.html">QDate</a>)</li>
<li>Time (<a href="qtime.html">QTime</a>)</li>
<li>The <a href="qt.html#TimeSpec-enum">time spec</a> offsetFromUtc (qint32) if <a href="qt.html#TimeSpec-enum">Qt::TimeSpec</a> is offsetFromUtc TimeZone(<a href="qtimezone.html">QTimeZone</a>) if <a href="qt.html#TimeSpec-enum">Qt::TimeSpec</a> is TimeZone</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qeasingcurve.html">QEasingCurve</a></td><td ><ul>
<li>type (quint8)</li>
<li>func (quint64)</li>
<li>hasConfig (bool)</li>
<li>If hasConfig is true then these fields follow:</li>
<li>list</li>
<li>period (double)</li>
<li>amplitude (double)</li>
<li>overshoot (double)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtgui/qfont.html">QFont</a></td><td ><ul>
<li>The family (<a href="qstring.html">QString</a>)</li>
<li>The style name (<a href="qstring.html">QString</a>)</li>
<li>The point size (double)</li>
<li>The pixel size (qint32)</li>
<li>The style hint (quint8)</li>
<li>The style strategy (quint16)</li>
<li>The char set (quint8)</li>
<li>The weight (quint8)</li>
<li>The font bits (quint8)</li>
<li>The font stretch (quint16)</li>
<li>The extended font bits (quint8)</li>
<li>The letter spacing (double)</li>
<li>The word spacing (double)</li>
<li>The hinting preference (quint8)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qhash.html#qhash">QHash</a>&lt;Key, T&gt;</td><td ><ul>
<li>The number of items (quint32)</li>
<li>For all items, the key (Key) and value (T)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtgui/qicon.html">QIcon</a></td><td ><ul>
<li>The number of pixmap entries (quint32)</li>
<li>For all pixmap entries:<ul>
<li>The pixmap (<a href="../qtgui/qpixmap.html">QPixmap</a>)</li>
<li>The file name (<a href="qstring.html">QString</a>)</li>
<li>The pixmap size (<a href="qsize.html">QSize</a>)</li>
<li>The <a href="../qtgui/qicon.html#Mode-enum">mode</a> (quint32)</li>
<li>The <a href="../qtgui/qicon.html#State-enum">state</a> (quint32)</li>
</ul>
</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="../qtgui/qimage.html">QImage</a></td><td ><ul>
<li>If the image is null a &quot;null image&quot; 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 <a href="qbuffer.html">QBuffer</a> (using <a href="../qtgui/qimageiohandler.html">QImageIOHandler</a>/<a href="../qtgui/qimageioplugin.html">QImageIOPlugin</a>) and stream that.</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtgui/qkeysequence.html">QKeySequence</a></td><td ><ul>
<li>A <a href="qlist.html">QList</a>&lt;int&gt;, where each integer is a key in the key sequence</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qlinkedlist.html">QLinkedList</a>&lt;T&gt;</td><td ><ul>
<li>The number of items (quint32)</li>
<li>The items (T)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qlist.html">QList</a>&lt;T&gt;</td><td ><ul>
<li>The number of items (quint32)</li>
<li>The items (T)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qmap.html">QMap</a>&lt;Key, T&gt;</td><td ><ul>
<li>The number of items (quint32)</li>
<li>For all items, the key (Key) and value (T)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qmargins.html">QMargins</a></td><td ><ul>
<li>left (int)</li>
<li>top (int)</li>
<li>right (int)</li>
<li>bottom (int)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td >QMatrix</td><td ><ul>
<li>m11 (double)</li>
<li>m12 (double)</li>
<li>m21 (double)</li>
<li>m22 (double)</li>
<li>dx (double)</li>
<li>dy (double)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtgui/qmatrix4x4.html">QMatrix4x4</a></td><td ><ul>
<li>m11 (float)</li>
<li>m12 (float)</li>
<li>m13 (float)</li>
<li>m14 (float)</li>
<li>m21 (float)</li>
<li>m22 (float)</li>
<li>m23 (float)</li>
<li>m24 (float)</li>
<li>m31 (float)</li>
<li>m32 (float)</li>
<li>m33 (float)</li>
<li>m34 (float)</li>
<li>m41 (float)</li>
<li>m42 (float)</li>
<li>m43 (float)</li>
<li>m44 (float)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qpair.html">QPair</a>&lt;T1, T2&gt;</td><td ><ul>
<li>first (T1)</li>
<li>second (T2)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtgui/qpalette.html">QPalette</a></td><td >The disabled, active, and inactive color groups, each of which consists of the following:<ul>
<li>foreground (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>button (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>light (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>midlight (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>dark (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>mid (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>text (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>brightText (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>buttonText (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>base (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>background (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>shadow (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>highlight (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>highlightedText (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>link (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
<li>linkVisited (<a href="../qtgui/qbrush.html">QBrush</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="../qtgui/qpen.html">QPen</a></td><td ><ul>
<li>The pen styles (quint8)</li>
<li>The pen width (quint16)</li>
<li>The pen color (<a href="../qtgui/qcolor.html">QColor</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtgui/qpicture.html">QPicture</a></td><td ><ul>
<li>The size of the picture data (quint32)</li>
<li>The raw bytes of picture data (char)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="../qtgui/qpixmap.html">QPixmap</a></td><td ><ul>
<li>Save it as a PNG image.</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qpoint.html">QPoint</a></td><td ><ul>
<li>The x coordinate (qint32)</li>
<li>The y coordinate (qint32)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="../qtgui/qquaternion.html">QQuaternion</a></td><td ><ul>
<li>The scalar component (float)</li>
<li>The x coordinate (float)</li>
<li>The y coordinate (float)</li>
<li>The z coordinate (float)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qrect.html">QRect</a></td><td ><ul>
<li>left (qint32)</li>
<li>top (qint32)</li>
<li>right (qint32)</li>
<li>bottom (qint32)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qregexp.html">QRegExp</a></td><td ><ul>
<li>The regexp pattern (<a href="qstring.html">QString</a>)</li>
<li>Case sensitivity (quint8)</li>
<li>Regular expression syntax (quint8)</li>
<li>Minimal matching (quint8)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qregularexpression.html">QRegularExpression</a></td><td ><ul>
<li>The regular expression pattern (<a href="qstring.html">QString</a>)</li>
<li>The pattern options (quint32)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="../qtgui/qregion.html">QRegion</a></td><td ><ul>
<li>The size of the data, i.e&#x2e; 8 + 16 * (number of rectangles) (quint32)</li>
<li>10 (qint32)</li>
<li>The number of rectangles (quint32)</li>
<li>The rectangles in sequential order (<a href="qrect.html">QRect</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qsize.html">QSize</a></td><td ><ul>
<li>width (qint32)</li>
<li>height (qint32)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qstring.html">QString</a></td><td ><ul>
<li>If the string is null: 0xFFFFFFFF (quint32)</li>
<li>Otherwise: The string length in bytes (quint32) followed by the data in UTF-16</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qtime.html">QTime</a></td><td ><ul>
<li>Milliseconds since midnight (quint32)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="../qtgui/qtransform.html">QTransform</a></td><td ><ul>
<li>m11 (double)</li>
<li>m12 (double)</li>
<li>m13 (double)</li>
<li>m21 (double)</li>
<li>m22 (double)</li>
<li>m23 (double)</li>
<li>m31 (double)</li>
<li>m32 (double)</li>
<li>m33 (double)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="qurl.html">QUrl</a></td><td ><ul>
<li>Holds an URL (<a href="qstring.html">QString</a>)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qvariant.html">QVariant</a></td><td ><ul>
<li>The type of the data (quint32)</li>
<li>The null flag (qint8)</li>
<li>The data of the specified type</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtgui/qvector2d.html">QVector2D</a></td><td ><ul>
<li>the x coordinate (float)</li>
<li>the y coordinate (float)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="../qtgui/qvector3d.html">QVector3D</a></td><td ><ul>
<li>the x coordinate (float)</li>
<li>the y coordinate (float)</li>
<li>the z coordinate (float)</li>
</ul>
</td></tr>
<tr valign="top" class="odd"><td ><a href="../qtgui/qvector4d.html">QVector4D</a></td><td ><ul>
<li>the x coordinate (float)</li>
<li>the y coordinate (float)</li>
<li>the z coordinate (float)</li>
<li>the w coordinate (float)</li>
</ul>
</td></tr>
<tr valign="top" class="even"><td ><a href="qvector.html">QVector</a>&lt;T&gt;</td><td ><ul>
<li>The number of items (quint32)</li>
<li>The items (T)</li>
</ul>
</td></tr>
</table></div>
</div>
<p><b>See also </b><a href="json.html">JSON Support in Qt</a>.</p>
<!-- @@@datastreamformat.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>