• PySide 模块
  • PySide.QtGui
  • 内容表

    上一话题

    QGraphicsSimpleTextItem

    下一话题

    QPainter

    QGraphicsPixmapItem

    概要

    函数

    详细描述

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

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

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

    ../../_images/graphicsview-pixmapitem.png

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

    You can set the pixmap's transformation mode by calling PySide.QtGui.QGraphicsPixmapItem.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 PySide.QtGui.QGraphicsPixmapItem.transformationMode() to get the current transformation mode for the item.

    class PySide.QtGui. QGraphicsPixmapItem ( [ parent=None [ , scene=None ] ] )
    class PySide.QtGui. QGraphicsPixmapItem ( pixmap [ , parent=None [ , scene=None ] ] )
    参数:
    PySide.QtGui.QGraphicsPixmapItem. ShapeMode

    This enum describes how PySide.QtGui.QGraphicsPixmapItem calculates its shape and opaque area.

    默认值为 MaskShape .

    常量 描述
    QGraphicsPixmapItem.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.
    QGraphicsPixmapItem.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.
    QGraphicsPixmapItem.HeuristicMaskShape The shape is determine by calling QPixmap.createHeuristicMask() . The performance and memory consumption is similar to MaskShape .
    PySide.QtGui.QGraphicsPixmapItem. offset ( )
    返回类型: PySide.QtCore.QPointF

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

    PySide.QtGui.QGraphicsPixmapItem. pixmap ( )
    返回类型: PySide.QtGui.QPixmap

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

    PySide.QtGui.QGraphicsPixmapItem. setOffset ( x , y )
    参数:
    • x PySide.QtCore.qreal
    • y PySide.QtCore.qreal

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

    PySide.QtGui.QGraphicsPixmapItem. setOffset ( offset )
    参数: offset PySide.QtCore.QPointF

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

    PySide.QtGui.QGraphicsPixmapItem. setPixmap ( pixmap )
    参数: pixmap PySide.QtGui.QPixmap

    Sets the item's pixmap to pixmap .

    PySide.QtGui.QGraphicsPixmapItem. setShapeMode ( mode )
    参数: mode PySide.QtGui.QGraphicsPixmapItem.ShapeMode

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

    另请参阅

    PySide.QtGui.QGraphicsPixmapItem.shapeMode() QGraphicsPixmapItem.ShapeMode

    PySide.QtGui.QGraphicsPixmapItem. setTransformationMode ( mode )
    参数: mode PySide.QtCore.Qt.TransformationMode
    PySide.QtGui.QGraphicsPixmapItem. shapeMode ( )
    返回类型: PySide.QtGui.QGraphicsPixmapItem.ShapeMode

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

    另请参阅

    PySide.QtGui.QGraphicsPixmapItem.setShapeMode() QGraphicsPixmapItem.ShapeMode

    PySide.QtGui.QGraphicsPixmapItem. transformationMode ( )
    返回类型: PySide.QtCore.Qt.TransformationMode

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