QGraphicsPixmapItemclass provides a pixmap item that you can add to aQGraphicsScene. 更多 …
def
offset
()
def
pixmap
()
def
setOffset
(offset)
def
setOffset
(x, y)
def
setPixmap
(pixmap)
def
setShapeMode
(mode)
def
setTransformationMode
(mode)
def
shapeMode
()
def
transformationMode
()
To set the item’s pixmap, pass a
QPixmaptoQGraphicsPixmapItem‘s constructor, or call thesetPixmap()function. Thepixmap()function returns the current pixmap.
QGraphicsPixmapItemuses pixmap’s optional alpha mask to provide a reasonable implementation ofboundingRect(),shape(),和contains().![]()
The pixmap is drawn at the item’s (0, 0) coordinate, as returned by
offset(). You can change the drawing offset by callingsetOffset().You can set the pixmap’s transformation mode by calling
setTransformationMode(). By default,FastTransformationis used, which provides fast, non-smooth scaling.SmoothTransformationenablesSmoothPixmapTransformon 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.
QGraphicsPixmapItem
(
[
parent=None
]
)
¶
QGraphicsPixmapItem(pixmap[, parent=None])
- param parent
- param pixmap
QPixmap
构造
QGraphicsPixmapItem
.
parent
会被传递给
QGraphicsItem
‘s constructor.
另请参阅
构造
QGraphicsPixmapItem
,使用
pixmap
作为默认像素图。
parent
会被传递给
QGraphicsItem
‘s constructor.
另请参阅
PySide2.QtWidgets.QGraphicsPixmapItem.
ShapeMode
¶
This enum describes how
QGraphicsPixmapItem
calculates its shape and opaque area.
The default value is .
|
常量 |
描述 |
|---|---|
|
QGraphicsPixmapItem.MaskShape |
The shape is determined by calling
|
|
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
|
PySide2.QtWidgets.QGraphicsPixmapItem.
offset
(
)
¶
QPointF
Returns the pixmap item’s offset , which defines the point of the top-left corner of the pixmap, in local coordinates.
另请参阅
PySide2.QtWidgets.QGraphicsPixmapItem.
pixmap
(
)
¶
QPixmap
Returns the item’s pixmap, or an invalid
QPixmap
if no pixmap has been set.
另请参阅
PySide2.QtWidgets.QGraphicsPixmapItem.
setOffset
(
offset
)
¶
offset
–
QPointF
Sets the pixmap item’s offset to
offset
.
QGraphicsPixmapItem
will draw its pixmap using
offset
for its top-left corner.
另请参阅
PySide2.QtWidgets.QGraphicsPixmapItem.
setOffset
(
x
,
y
)
¶
x
–
qreal
y
–
qreal
This convenience function is equivalent to calling
setOffset
(
QPointF
(
x
,
y
)).
PySide2.QtWidgets.QGraphicsPixmapItem.
setPixmap
(
pixmap
)
¶
pixmap
–
QPixmap
Sets the item’s pixmap to
pixmap
.
另请参阅
PySide2.QtWidgets.QGraphicsPixmapItem.
setShapeMode
(
mode
)
¶
mode
–
ShapeMode
Sets the item’s shape mode to
mode
. The shape mode describes how
QGraphicsPixmapItem
calculates its shape. The default mode is
MaskShape
.
另请参阅
shapeMode()
ShapeMode
PySide2.QtWidgets.QGraphicsPixmapItem.
setTransformationMode
(
mode
)
¶
mode
–
TransformationMode
Sets the pixmap item’s transformation mode to
mode
, and toggles an update of the item. The default mode is
FastTransformation
, which provides quick transformation with no smoothing.
SmoothTransformation
enables
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.
另请参阅
PySide2.QtWidgets.QGraphicsPixmapItem.
shapeMode
(
)
¶
Returns the item’s shape mode. The shape mode describes how
QGraphicsPixmapItem
calculates its shape. The default mode is
MaskShape
.
另请参阅
setShapeMode()
ShapeMode
PySide2.QtWidgets.QGraphicsPixmapItem.
transformationMode
(
)
¶
TransformationMode
Returns the transformation mode of the pixmap. The default mode is
FastTransformation
, which provides quick transformation with no smoothing.