QGraphicsPixmapItem Class Reference
[QtGui module]
该QGraphicsPixmapItem类提供了一个图片项目,你可以添加到QGraphicsScene。More…
Types
enum ShapeMode { MaskShape, BoundingRectShape, HeuristicMaskShape }
Methods
__init__ (self, QGraphicsItem parent = None, QGraphicsScene scene = None)
__init__ (self, QPixmap pixmap, QGraphicsItem parent = None, QGraphicsScene scene = None)
QRectF boundingRect (self)
bool contains (self, QPointF point)
bool isObscuredBy (self, QGraphicsItem item)
QPointF offset (self)
QPainterPath opaqueArea (self)
paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget)
QPixmap pixmap (self)
setOffset (self, QPointF offset)
setOffset (self, float ax, float ay)
setPixmap (self, QPixmap pixmap)
setShapeMode (self, ShapeMode mode)
setTransformationMode (self, Qt.TransformationMode mode)
QPainterPath shape (self)
ShapeMode shapeMode (self)
Qt.TransformationMode transformationMode (self)
int type (self)
Detailed Description
该QGraphicsPixmapItem类提供了一个图片项目,你可以添加到QGraphicsScene。
要设置项目的像素图,通过一个QPixmap到QGraphicsPixmapItem的构造函数,或致电setPixmap()函数。该pixmap( )函数返回当前像素图。
QGraphicsPixmapItem使用像素图的可选的alpha掩码来提供合理的实施boundingRect( )shape()和contains( ) 。
像素图被绘制在该项目的(0 ,0)坐标,所返回的offset( ) 。你可以通过调用更改绘图偏移setOffset( ) 。
你可以通过调用设定的像素图的转型模式setTransformationMode( ) 。默认情况下,Qt.FastTransformation使用时,可提供快速,非平滑缩放。Qt.SmoothTransformation enables QPainter.SmoothPixmapTransform在画家和质量取决于平台和视口上。结果通常是不如叫QPixmap.scale ( )直接。通话transformationMode( )来获得该项目目前的转型模式。
Type Documentation
QGraphicsPixmapItem.ShapeMode
这个枚举说明如何QGraphicsPixmapItem计算其形状和不透明的区域。
默认值是MaskShape 。
Constant | Value | Description |
---|---|---|
QGraphicsPixmapItem.MaskShape |
0 |
该形状是通过调用确定QPixmap.mask( ) 。这种形状仅包括不透明像素的像素图的。由于形状比较复杂,但是,它可以比其它模式更慢,并且使用更多的存储器。 |
QGraphicsPixmapItem.BoundingRectShape |
1 |
该形状是由跟踪像素映像的轮廓来确定。这是最快的形状模式,但它并没有考虑到的像素图的任何透明区域。 |
QGraphicsPixmapItem.HeuristicMaskShape |
2 |
该形状是通过调用确定QPixmap.createHeuristicMask( ) 。性能和内存消耗是类似MaskShape 。 |
Method Documentation
QGraphicsPixmapItem.__init__ (self, QGraphicsItem parent = None, QGraphicsScene scene = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
该scene的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个QGraphicsPixmapItem。parent被传递给QGraphicsItem的构造。
See also QGraphicsScene.addItem( ) 。
QGraphicsPixmapItem.__init__ (self, QPixmap pixmap, QGraphicsItem parent = None, QGraphicsScene scene = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
该scene的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个QGraphicsPixmapItem,使用pixmap作为默认的pixmap 。parent被传递给QGraphicsItem的构造。
See also QGraphicsScene.addItem( ) 。
QRectF QGraphicsPixmapItem.boundingRect (self)
从重新实现QGraphicsItem.boundingRect( ) 。
bool QGraphicsPixmapItem.contains (self, QPointF point)
从重新实现QGraphicsItem.contains( ) 。
bool QGraphicsPixmapItem.isObscuredBy (self, QGraphicsItem item)
从重新实现QGraphicsItem.isObscuredBy( ) 。
QPointF QGraphicsPixmapItem.offset (self)
[
返回图片项目的offset,它定义了像素图的左上角,在局部坐标的点。
]($docs-qpointf.html)
QPainterPath QGraphicsPixmapItem.opaqueArea (self)
从重新实现QGraphicsItem.opaqueArea( ) 。
QGraphicsPixmapItem.paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget)
从重新实现QGraphicsItem.paint( ) 。
QPixmap QGraphicsPixmapItem.pixmap (self)
返回该项目的像素图,或无效QPixmap如果没有像素图已定。
See also setPixmap( ) 。
QGraphicsPixmapItem.setOffset (self, QPointF offset)
设置图片项目的偏移量offset。QGraphicsPixmapItem将使用绘制其像素图offset其左上角。
See also offset( ) 。
QGraphicsPixmapItem.setOffset (self, float ax, float ay)
这个方便的功能等同于调用setOffset (QPointF(x,y))。
此功能被引入Qt的4.3 。
QGraphicsPixmapItem.setPixmap (self, QPixmap pixmap)
设置项的像素图来pixmap。
See also pixmap( ) 。
QGraphicsPixmapItem.setShapeMode (self, ShapeMode mode)
设置项的形状模式mode。形模式描述了如何QGraphicsPixmapItem计算出其形状。默认模式是MaskShape。
See also shapeMode()和ShapeMode。
QGraphicsPixmapItem.setTransformationMode (self, Qt.TransformationMode mode)
设置图片项目的改造模式mode,并切换该项目的更新。默认模式是Qt.FastTransformation,它提供了无平滑快速转型。
Qt.SmoothTransformation enables QPainter.SmoothPixmapTransform在画家和质量取决于平台和视口上。结果通常是不如叫QPixmap.scale ( )直接。
See also transformationMode( ) 。
QPainterPath QGraphicsPixmapItem.shape (self)
ShapeMode QGraphicsPixmapItem.shapeMode (self)
返回该项目的形状模式。形模式描述了如何QGraphicsPixmapItem计算出其形状。默认模式是MaskShape。
See also setShapeMode()和ShapeMode。
Qt.TransformationMode QGraphicsPixmapItem.transformationMode (self)
返回像素图的改造模式。默认模式是Qt.FastTransformation,它提供了无平滑快速转型。
See also setTransformationMode( ) 。
int QGraphicsPixmapItem.type (self)
从重新实现QGraphicsItem.type( ) 。