Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QGraphicsPixmapItem Class

TheQGraphicsPixmapItem class provides a pixmap item that you can add to aQGraphicsScene.More...

Header:#include <QGraphicsPixmapItem>
Since: Qt 4.2
Inherits:QGraphicsItem

Public Types

enumShapeMode { MaskShape, BoundingRectShape, HeuristicMaskShape }

Public Functions

QGraphicsPixmapItem(QGraphicsItem * parent = 0)
QGraphicsPixmapItem(const QPixmap & pixmap, QGraphicsItem * parent = 0)
~QGraphicsPixmapItem()
QPointFoffset() const
QPixmappixmap() const
voidsetOffset(const QPointF & offset)
voidsetOffset(qreal x, qreal y)
voidsetPixmap(const QPixmap & pixmap)
voidsetShapeMode(ShapeMode mode)
voidsetTransformationMode(Qt::TransformationMode mode)
ShapeModeshapeMode() const
Qt::TransformationModetransformationMode() const

Reimplemented Public Functions

virtual QRectFboundingRect() const
virtual boolcontains(const QPointF & point) const
virtual boolisObscuredBy(const QGraphicsItem * item) const
virtual QPainterPathopaqueArea() const
virtual voidpaint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
virtual QPainterPathshape() const
virtual inttype() const

Additional Inherited Members

Detailed Description

TheQGraphicsPixmapItem class provides a pixmap item that you can add to aQGraphicsScene.

To set the item's pixmap, pass aQPixmap toQGraphicsPixmapItem's constructor, or call thesetPixmap() function. Thepixmap() function returns the current pixmap.

QGraphicsPixmapItem uses pixmap's optional alpha mask to provide a reasonable implementation ofboundingRect(),shape(), andcontains().

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

You can set the pixmap's transformation mode by callingsetTransformationMode(). By default,Qt::FastTransformation is used, which provides fast, non-smooth scaling.Qt::SmoothTransformation enablesQPainter::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. CalltransformationMode() to get the current transformation mode for the item.

See alsoQGraphicsPathItem,QGraphicsRectItem,QGraphicsEllipseItem,QGraphicsTextItem,QGraphicsPolygonItem,QGraphicsLineItem, andGraphics View Framework.

Member Type Documentation

enum QGraphicsPixmapItem::ShapeMode

This enum describes howQGraphicsPixmapItem calculates its shape and opaque area.

The default value is MaskShape.

ConstantValueDescription
QGraphicsPixmapItem::MaskShape0The shape is determined by callingQPixmap::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.
QGraphicsPixmapItem::BoundingRectShape1The 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.
QGraphicsPixmapItem::HeuristicMaskShape2The shape is determine by callingQPixmap::createHeuristicMask(). The performance and memory consumption is similar to MaskShape.

Member Function Documentation

QGraphicsPixmapItem::QGraphicsPixmapItem(QGraphicsItem * parent = 0)

Constructs aQGraphicsPixmapItem.parent is passed toQGraphicsItem's constructor.

See alsoQGraphicsScene::addItem().

QGraphicsPixmapItem::QGraphicsPixmapItem(constQPixmap & pixmap,QGraphicsItem * parent = 0)

Constructs aQGraphicsPixmapItem, usingpixmap as the default pixmap.parent is passed toQGraphicsItem's constructor.

See alsoQGraphicsScene::addItem().

QGraphicsPixmapItem::~QGraphicsPixmapItem()

Destroys theQGraphicsPixmapItem.

[virtual]QRectF QGraphicsPixmapItem::boundingRect() const

Reimplemented fromQGraphicsItem::boundingRect().

[virtual]bool QGraphicsPixmapItem::contains(constQPointF & point) const

Reimplemented fromQGraphicsItem::contains().

[virtual]bool QGraphicsPixmapItem::isObscuredBy(constQGraphicsItem * item) const

Reimplemented fromQGraphicsItem::isObscuredBy().

QPointF QGraphicsPixmapItem::offset() const

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

See alsosetOffset().

[virtual]QPainterPath QGraphicsPixmapItem::opaqueArea() const

Reimplemented fromQGraphicsItem::opaqueArea().

[virtual]void QGraphicsPixmapItem::paint(QPainter * painter, constQStyleOptionGraphicsItem * option,QWidget * widget)

Reimplemented fromQGraphicsItem::paint().

QPixmap QGraphicsPixmapItem::pixmap() const

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

See alsosetPixmap().

void QGraphicsPixmapItem::setOffset(constQPointF & offset)

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

See alsooffset().

void QGraphicsPixmapItem::setOffset(qreal x,qreal y)

This convenience function is equivalent to callingsetOffset(QPointF(x,y)).

This function was introduced in Qt 4.3.

void QGraphicsPixmapItem::setPixmap(constQPixmap & pixmap)

Sets the item's pixmap topixmap.

See alsopixmap().

void QGraphicsPixmapItem::setShapeMode(ShapeMode mode)

Sets the item's shape mode tomode. The shape mode describes howQGraphicsPixmapItem calculates its shape. The default mode isMaskShape.

See alsoshapeMode() andShapeMode.

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

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

Qt::SmoothTransformation enablesQPainter::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.

See alsotransformationMode().

[virtual]QPainterPath QGraphicsPixmapItem::shape() const

Reimplemented fromQGraphicsItem::shape().

ShapeMode QGraphicsPixmapItem::shapeMode() const

Returns the item's shape mode. The shape mode describes howQGraphicsPixmapItem calculates its shape. The default mode isMaskShape.

See alsosetShapeMode() andShapeMode.

Qt::TransformationMode QGraphicsPixmapItem::transformationMode() const

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

See alsosetTransformationMode().

[virtual]int QGraphicsPixmapItem::type() const

Reimplemented fromQGraphicsItem::type().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp