Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Serializing Qt Data Types

The QDataStream allows you to serialize some of the Qt data types. The table below lists the data types that QDataStream can serialize and how they are represented. The format described below is version 12.

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.

bool
  • boolean
qint8
  • signed byte
qint16
  • signed 16-bit integer
qint32
  • signed 32-bit integer
qint64
  • signed 64-bit integer
quint8
  • unsigned byte
quint16
  • unsigned 16-bit integer
quint32
  • unsigned 32-bit integer
quint64
  • unsigned 64-bit integer
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
  • Color spec (qint8)
  • Alpha value (quint16)
  • Red value (quint16)
  • Green value (quint16)
  • Blue value (quint16)
  • Pad value (quint16)
QCursor
  • Shape ID (qint16)
  • If shape is BitmapCursor: The bitmap (QPixmap), mask (QPixmap), and hot spot (QPoint)
QDate
  • Julian day (quint32)
QDateTime
QEasingCurve
  • type (quint8)
  • func (quint64)
  • hasConfig (bool)
  • If hasConfig is true then these fields follow:
  • list
  • period (double)
  • amplitude (double)
  • overshoot (double)
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)
QIcon
  • The number of pixmap entries (quint32)
  • For all pixmap entries:
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(obsolete)
  • m11 (double)
  • m12 (double)
  • m21 (double)
  • m22 (double)
  • dx (double)
  • dy (double)
QMatrix4x4
  • m11 (double)
  • m12 (double)
  • m13 (double)
  • m14 (double)
  • m21 (double)
  • m22 (double)
  • m23 (double)
  • m24 (double)
  • m31 (double)
  • m32 (double)
  • m33 (double)
  • m34 (double)
  • m41 (double)
  • m42 (double)
  • m43 (double)
  • m44 (double)
QPair<T1, T2>
  • first (T1)
  • second (T2)
QPaletteThe 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
  • Save it as a PNG image.
QPoint
  • The x coordinate (qint32)
  • The y coordinate (qint32)
QQuaternion
  • The scalar component (double)
  • The x coordinate (double)
  • The y coordinate (double)
  • The z coordinate (double)
QRect
  • left (qint32)
  • top (qint32)
  • right (qint32)
  • bottom (qint32)
QRegExp
  • The regexp pattern (QString)
  • Case sensitivity (quint8)
  • Regular expression syntax (quint8)
  • Minimal matching (quint8)
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)
QTransform
  • m11 (double)
  • m12 (double)
  • m13 (double)
  • m21 (double)
  • m22 (double)
  • m23 (double)
  • m31 (double)
  • m32 (double)
  • m33 (double)
QUrl
QVariant
  • The type of the data (quint32)
  • The null flag (qint8)
  • The data of the specified type
QVector2D
  • the x coordinate (double)
  • the y coordinate (double)
QVector3D
  • the x coordinate (double)
  • the y coordinate (double)
  • the z coordinate (double)
QVector4D
  • the x coordinate (double)
  • the y coordinate (double)
  • the z coordinate (double)
  • the w coordinate (double)
QVector<T>
  • The number of items (quint32)
  • The items (T)
Publicit�

Best Of

Actualit�s les plus lues

Semaine
Mois
Ann�e
  1. Microsoft ouvre aux autres compilateurs C++ AMP, la sp�cification pour la conception d'applications parall�les C++ utilisant le GPU 22
  2. Les d�veloppeurs ignorent-ils trop les failles d�couvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. RIM : � 13 % des d�veloppeurs ont gagn� plus de 100 000 $ sur l'AppWord �, Qt et open-source au menu du BlackBerry DevCon Europe 0
  4. � Quelque chose ne va vraiment pas avec les d�veloppeurs "modernes" �, un d�veloppeur � "l'ancienne" critique la multiplication des biblioth�ques 12
  5. BlackBerry 10 : premi�res images du prochain OS de RIM qui devrait int�grer des widgets et des tuiles inspir�es de Windows Phone 0
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil d�claratif et extensible pour la compilation de projets Qt 17
  7. Quelles nouveaut�s de C++11 Visual C++ doit-il rapidement int�grer ? Donnez-nous votre avis 10
Page suivante

Le Qt Developer Network au hasard

Logo

Compiler l'add-in Qt de Visual Studio

Le Qt Developer Network est un r�seau de d�veloppeurs Qt anglophone, o� ils peuvent partager leur exp�rience sur le framework. Lire l'article.

Communaut�

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la r�daction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, �crite par Nokia Corporation and/or its subsidiary(-ies). Les �ventuels probl�mes r�sultant d'une mauvaise traduction ne sont pas imputables � Nokia. Qt 4.7
Copyright © 2012 Developpez LLC. Tous droits r�serv�s Developpez LLC. Aucune reproduction, m�me partielle, ne peut �tre faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'� 3 ans de prison et jusqu'� 300 000 E de dommages et int�r�ts. Cette page est d�pos�e � la SACD.
Vous avez d�nich� une erreur ? Un bug ? Une redirection cass�e ? Ou tout autre probl�me, quel qu'il soit ? Ou bien vous d�sirez participer � ce projet de traduction ? N'h�sitez pas � nous contacter ou par MP !
 
 
 
 
Partenaires

H�bergement Web