Qt:Документация 4.3.2/qgraphicspixmapitem

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

QGraphicsPixmapItem Class Reference
[модуль QtGui ]

The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene. Далее...

 #include <QGraphicsPixmapItem>

Inherits QGraphicsItem.

Класс был добавлен в Qt 4.2.

Открытые типы

  • enum ShapeMode { MaskShape, BoundingRectShape, HeuristicMaskShape }

Открытые функции

Дополнительные унаследованные члены


Подробное описание

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 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().

center

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.

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


Описание типов

enum QGraphicsPixmapItem::ShapeMode

This enum describes how QGraphicsPixmapItem calculates its shape.

The default value is MaskShape.


Константа Значение Описание
QGraphicsPixmapItem::MaskShape 0 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.
QGraphicsPixmapItem::BoundingRectShape 1 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.
QGraphicsPixmapItem::HeuristicMaskShape 2 The shape is determine by calling QPixmap::createHeuristicMask(). The performance and memory consumption is similar to MaskShape.

Описание функций-членов

QGraphicsPixmapItem::QGraphicsPixmapItem ( QGraphicsItem * parent = 0 )

Constructs a QGraphicsPixmapItem. parent is passed to QGraphicsItem's constructor.

See also QGraphicsScene::addItem().

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

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

See also QGraphicsScene::addItem().

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.

Смотрите также 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::setOffset ( qreal x, qreal y )

Эта перегруженная функция предоставлена для удобства.

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

Эта функция была введена в Qt 4.3.

void QGraphicsPixmapItem::setPixmap ( const QPixmap & pixmap )

Sets the item's pixmap to pixmap.

Смотрите также pixmap().

void QGraphicsPixmapItem::setShapeMode ( ShapeMode mode )

Sets the item's shape mode to mode. The shape mode describes how QGraphicsPixmapItem calculates its shape. The default mode is MaskShape.

See also shapeMode() and ShapeMode.

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.

See also transformationMode().

ShapeMode QGraphicsPixmapItem::shapeMode () const

Returns the item's shape mode. The shape mode describes how QGraphicsPixmapItem calculates its shape. The default mode is MaskShape.

See also setShapeMode() and ShapeMode.

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().



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2