|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QGraphicsPixmapItem Class Reference
[QtGui module]

The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene. More...

    #include <QGraphicsPixmapItem>

Inherits QGraphicsItem.

This class was introduced in Qt 4.2.

- List of all members, including inherited members

### Public Functions

- QGraphicsPixmapItem ( QGraphicsItem * parent = 0, QGraphicsScene * scene = 0 )
- QGraphicsPixmapItem ( const QPixmap & pixmap, QGraphicsItem * parent = 0, QGraphicsScene * scene = 0 )
- ~QGraphicsPixmapItem ()
- QPointF offset () const
- QPixmap pixmap () const
- void setOffset ( const QPointF & offset )
- void setPixmap ( const QPixmap & pixmap )
- void setTransformationMode ( Qt::TransformationMode mode )
- Qt::TransformationMode transformationMode () const

- 102 public functions inherited from QGraphicsItem

### Additional Inherited Members

- 23 protected functions inherited from QGraphicsItem

## Detailed Description

The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene.

To set the item's pixmap, pass a QPixmap to QGraphicsPixmapItem's constructor, or call setPixmap(). pixmap() returns the current pixmap.

QGraphicsPixmapItem uses pixmap's optional alpha mask to provide a reasonable implementation of boundingRect(), shape(), and contains().

The pixmap is drawn at the item's (0, 0) coordinate, as returned by offset(). You can change the drawing offset by calling setOffset().

You can set the pixmap's transformation mode by calling setTransformationMode(). By default, Qt::FastTransformation is used, which provides fast, non-smooth scaling. Call transformationMode() to get the current transformation mode for the item.

See also QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsTextItem, QGraphicsPolygonItem, QGraphicsLineItem, and The Graphics View Framework.

## Member Function Documentation

### QGraphicsPixmapItem::QGraphicsPixmapItem ( QGraphicsItem * parent = 0, QGraphicsScene * scene = 0 )

Constructs a QGraphicsPixmapItem. parent and scene are passed to QGraphicsItem's constructor.

### QGraphicsPixmapItem::QGraphicsPixmapItem ( const QPixmap & pixmap, QGraphicsItem * parent = 0, QGraphicsScene * scene = 0 )

Constructs a QGraphicsPixmapItem, using pixmap as the default pixmap. parent and scene are passed to QGraphicsItem's constructor.

### QGraphicsPixmapItem::~QGraphicsPixmapItem ()

Destroys the QGraphicsPixmapItem.

### QPointF QGraphicsPixmapItem::offset () const

Returns the pixmap item's offset, which defines the point of the top-left corner of the pixmap, in local coordinates.

See also setOffset().

### QPixmap QGraphicsPixmapItem::pixmap () const

Returns the item's pixmap, or an invalid QPixmap if no pixmap has been set.

See also setPixmap().

### void QGraphicsPixmapItem::setOffset ( const QPointF & offset )

Sets the pixmap item's offset to offset. QGraphicsPixmapItem will draw its pixmap using offset for its top-left corner.

See also offset().

### void QGraphicsPixmapItem::setPixmap ( const QPixmap & pixmap )

Sets the item's pixmap to pixmap.

See also pixmap().

### void QGraphicsPixmapItem::setTransformationMode ( Qt::TransformationMode mode )

Sets the pixmap item's transformation mode to mode, and toggles an update of the item. The default mode is Qt::FastTransformation, which provides quick transformation with no smoothing.

See also transformationMode().

### Qt::TransformationMode QGraphicsPixmapItem::transformationMode () const

Returns the transformation mode of the pixmap. The default mode is Qt::FastTransformation, which provides quick transformation with no smoothing.

See also setTransformationMode().