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  · 

Q3CanvasPixmap Class Reference

The Q3CanvasPixmap class provides pixmaps for Q3CanvasSprites. More...

 #include <Q3CanvasPixmap>

This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.

Inherits: QPixmap.

Public Functions

Q3CanvasPixmap ( const QString & datafilename )
Q3CanvasPixmap ( const QImage & image )
Q3CanvasPixmap ( const QPixmap & pm, const QPoint & offset )
~Q3CanvasPixmap ()
int offsetX () const
int offsetY () const
void setOffset ( int x, int y )

Additional Inherited Members

  • 14 static public members inherited from QPixmap
  • 1 protected function inherited from QPaintDevice

Detailed Description

The Q3CanvasPixmap class provides pixmaps for Q3CanvasSprites.

If you want to show a single pixmap on a Q3Canvas use a Q3CanvasSprite with just one pixmap.

When pixmaps are inserted into a Q3CanvasPixmapArray they are held as Q3CanvasPixmaps. Q3CanvasSprites are used to show pixmaps on Q3Canvases and hold their pixmaps in a Q3CanvasPixmapArray. If you retrieve a frame (pixmap) from a Q3CanvasSprite it will be returned as a Q3CanvasPixmap.

The pixmap is a QPixmap and can only be set in the constructor. There are three different constructors, one taking a QPixmap, one a QImage and one a file name that refers to a file in any supported file format (see QImageReader).

Q3CanvasPixmap can have a hotspot which is defined in terms of an (x, y) offset. When you create a Q3CanvasPixmap from a PNG file or from a QImage that has a QImage::offset(), the offset() is initialized appropriately, otherwise the constructor leaves it at (0, 0). You can set it later using setOffset(). When the Q3CanvasPixmap is used in a Q3CanvasSprite, the offset position is the point at Q3CanvasItem::x() and Q3CanvasItem::y(), not the top-left corner of the pixmap.

Note that for Q3CanvasPixmap objects created by a Q3CanvasSprite, the position of each Q3CanvasPixmap object is set so that the hotspot stays in the same position.

See also Q3CanvasPixmapArray, Q3CanvasItem, Q3CanvasSprite, QtCanvas, and Porting to Graphics View.

Member Function Documentation

Q3CanvasPixmap::Q3CanvasPixmap ( const QString & datafilename )

Constructs a Q3CanvasPixmap that uses the image stored in datafilename.

Q3CanvasPixmap::Q3CanvasPixmap ( const QImage & image )

Constructs a Q3CanvasPixmap from the image image.

Q3CanvasPixmap::Q3CanvasPixmap ( const QPixmap & pm, const QPoint & offset )

Constructs a Q3CanvasPixmap from the pixmap pm using the offset offset.

Q3CanvasPixmap::~Q3CanvasPixmap ()

Destroys the pixmap.

int Q3CanvasPixmap::offsetX () const

Returns the x-offset of the pixmap's hotspot.

See also setOffset().

int Q3CanvasPixmap::offsetY () const

Returns the y-offset of the pixmap's hotspot.

See also setOffset().

void Q3CanvasPixmap::setOffset ( int x, int y )

Sets the offset of the pixmap's hotspot to (x, y).

Warning: Do not call this function if any Q3CanvasSprites are currently showing this pixmap.

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.8
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