QtBase
v6.3.1
|
The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene. More...
#include <qgraphicsitem.h>
Additional Inherited Members | |
Protected Types inherited from QGraphicsItem | |
enum | Extension { UserExtension = 0x80000000 } |
Protected Attributes inherited from QGraphicsItem | |
QScopedPointer< QGraphicsItemPrivate > | d_ptr |
Related Functions inherited from QGraphicsItem | |
T | qgraphicsitem_cast (QGraphicsItem *item) |
The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene.
\inmodule QtWidgets
To set the item's pixmap, pass a QPixmap to QGraphicsPixmapItem's constructor, or call the setPixmap() function. The pixmap() function 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. Qt::SmoothTransformation enables QPainter::SmoothPixmapTransform on the painter, and the quality depends on the platform and viewport. The result is usually not as good as calling QPixmap::scale() directly. Call transformationMode() to get the current transformation mode for the item.
Definition at line 803 of file qgraphicsitem.h.
anonymous enum |
Enumerator | |
---|---|
Type |
Definition at line 835 of file qgraphicsitem.h.
This enum describes how QGraphicsPixmapItem calculates its shape and opaque area.
The default value is MaskShape.
\value MaskShape The shape is determined by calling QPixmap::mask(). This shape includes only the opaque pixels of the pixmap. Because the shape is more complex, however, it can be slower than the other modes, and uses more memory.
\value BoundingRectShape The shape is determined by tracing the outline of the pixmap. This is the fastest shape mode, but it does not take into account any transparent areas on the pixmap.
\value HeuristicMaskShape The shape is determine by calling QPixmap::createHeuristicMask(). The performance and memory consumption is similar to MaskShape.
Enumerator | |
---|---|
MaskShape | |
BoundingRectShape | |
HeuristicMaskShape |
Definition at line 806 of file qgraphicsitem.h.
|
explicit |
Constructs a QGraphicsPixmapItem. parent is passed to QGraphicsItem's constructor.
Definition at line 9472 of file qgraphicsitem.cpp.
|
explicit |
Constructs a QGraphicsPixmapItem, using pixmap as the default pixmap. parent is passed to QGraphicsItem's constructor.
Definition at line 9460 of file qgraphicsitem.cpp.
QGraphicsPixmapItem::~QGraphicsPixmapItem | ( | ) |
Destroys the QGraphicsPixmapItem.
Definition at line 9480 of file qgraphicsitem.cpp.
|
overridevirtual |
\reimp
Implements QGraphicsItem.
Reimplemented in ImageItem.
Definition at line 9582 of file qgraphicsitem.cpp.
\reimp
Reimplemented from QGraphicsItem.
Definition at line 9612 of file qgraphicsitem.cpp.
Reimplemented from QGraphicsItem.
Definition at line 9706 of file qgraphicsitem.cpp.
|
overridevirtual |
\reimp
Reimplemented from QGraphicsItem.
Definition at line 9638 of file qgraphicsitem.cpp.
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.
Definition at line 9549 of file qgraphicsitem.cpp.
|
overridevirtual |
\reimp
Reimplemented from QGraphicsItem.
Definition at line 9646 of file qgraphicsitem.cpp.
|
overridevirtual |
\reimp
Implements QGraphicsItem.
Reimplemented in UpdatedPixmapCacheItem, AnimatedPixmapCacheItem, ImageItem, and ExposedPixmapItem.
Definition at line 9620 of file qgraphicsitem.cpp.
QPixmap QGraphicsPixmapItem::pixmap | ( | ) | const |
Returns the item's pixmap, or an invalid QPixmap if no pixmap has been set.
Definition at line 9504 of file qgraphicsitem.cpp.
|
overrideprotectedvirtual |
Reimplemented from QGraphicsItem.
Definition at line 9697 of file qgraphicsitem.cpp.
Sets the pixmap item's offset to offset. QGraphicsPixmapItem will draw its pixmap using offset for its top-left corner.
Definition at line 9561 of file qgraphicsitem.cpp.
This convenience function is equivalent to calling setOffset(QPointF(x, y)).
Definition at line 851 of file qgraphicsitem.h.
Sets the item's pixmap to pixmap.
Definition at line 9489 of file qgraphicsitem.cpp.
Sets the item's shape mode to mode. The shape mode describes how QGraphicsPixmapItem calculates its shape. The default mode is MaskShape.
Definition at line 9676 of file qgraphicsitem.cpp.
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.
Qt::SmoothTransformation enables QPainter::SmoothPixmapTransform on the painter, and the quality depends on the platform and viewport. The result is usually not as good as calling QPixmap::scale() directly.
Definition at line 9534 of file qgraphicsitem.cpp.
|
overridevirtual |
\reimp
Reimplemented from QGraphicsItem.
Definition at line 9598 of file qgraphicsitem.cpp.
QGraphicsPixmapItem::ShapeMode QGraphicsPixmapItem::shapeMode | ( | ) | const |
Returns the item's shape mode. The shape mode describes how QGraphicsPixmapItem calculates its shape. The default mode is MaskShape.
Definition at line 9665 of file qgraphicsitem.cpp.
|
overrideprotectedvirtual |
Reimplemented from QGraphicsItem.
Definition at line 9688 of file qgraphicsitem.cpp.
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.
Definition at line 9517 of file qgraphicsitem.cpp.
|
overridevirtual |