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  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Fonctions  · 

Format of the QDataStream Operators

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.

It is best to always cast integers to a Qt integer type when writing, and to read back into the same Qt integer type when reading.

Q_INT8
  • signed byte
Q_INT16
  • signed 16 bit integer
Q_INT32
  • signed 32 bit integer
Q_UINT8
  • unsigned byte
Q_UINT16
  • unsigned 16 bit integer
Q_UINT32
  • unsigned 32 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
char *
  • The size of the string including the terminating 0 (Q_UINT32)
  • The string bytes including the terminating 0
The null string is represented as (Q_UINT32) 0.
QBitArray
  • The array size (Q_UINT32)
  • The array bits, i.e. (size + 7)/8 bytes
QBrush
  • The brush style (Q_UINT8)
  • The brush color (QColor)
  • If style is CustomPattern, the brush pixmap (QPixmap)
QByteArray
  • The array size (Q_UINT32)
  • The array bytes, i.e. size bytes
QCString
  • The size of the string including the terminating 0 (Q_UINT32)
  • The string bytes including the terminating 0
The null string is represented as (Q_UINT32) 0.
QColor
  • RGB value serialized as a Q_UINT32
QColorGroup
  • foreground (QBrush)
  • button (QBrush)
  • light (QBrush)
  • midLight (QBrush)
  • dark (QBrush)
  • mid (QBrush)
  • text (QBrush)
  • brightText (QBrush)
  • ButtonText (QBrush)
  • base (QBrush)
  • background (QBrush)
  • shadow (QBrush)
  • highlight (QBrush)
  • highlightedText (QBrush)
QCursor
  • Shape id (Q_INT16)
  • If shape is BitmapCursor: The bitmap (QPixmap), mask (QPixmap) and hot spot (QPoint)
QDate
  • Julian day (Q_UINT32)
QDateTime
QFont
  • The family (QCString)
  • The point size (Q_INT16)
  • The style hint (Q_UINT8)
  • The char set (Q_UINT8)
  • The weight (Q_UINT8)
  • The font bits (Q_UINT8)
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.
QMap
  • The number of items (Q_UINT32)
  • For all items, the key and value
QPalette
  • active (QColorGroup)
  • disabled (QColorGroup)
  • inactive (QColorGroup)
QPen
  • The pen styles (Q_UINT8)
  • The pen width (Q_UINT8)
  • The pen color (QColor)
QPicture
  • The size of the picture data (Q_UINT32)
  • The raw bytes of picture data (char)
QPixmap
  • Save it as a PNG image.
QPoint
  • The x coordinate (Q_INT32)
  • The y coordinate (Q_INT32)
QPointArray
  • The array size (Q_UINT32)
  • The array points (QPoint)
QRect
  • left (Q_INT32)
  • top (Q_INT32)
  • right (Q_INT32)
  • bottom (Q_INT32)
QRegion
  • The size of the data, i.e. 8 + 16 * (number of rectangles) (Q_UINT32)
  • QRGN_RECTS (Q_INT32)
  • The number of rectangles (Q_UINT32)
  • The rectangles in sequential order (QRect)
QSize
  • width (Q_INT32)
  • height (Q_INT32)
QString
  • If the string is null: 0xffffffff (Q_UINT32)
    otherwise: The string length (Q_UINT32) followed by the data in UTF-16
QTime
  • Milliseconds since midnight (Q_UINT32)
QValueList
  • The number of list elements (Q_UINT32)
  • All the elements in sequential order
QVariant
  • The type of the data (Q_UINT32)
  • The data of the specified type
QWMatrix
  • m11 (double)
  • m12 (double)
  • m21 (double)
  • m22 (double)
  • dx (double)
  • dy (double)

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 53
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  4. 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
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. 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 3.3
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