Skip to content

PythonQt.QtGui.QGraphicsItem

QGraphicsItem

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

It provides a light-weight foundation for writing your own custom items. This includes defining the item's geometry, collision detection, its painting implementation and item interaction through its event handlers. QGraphicsItem is part of the Graphics View Framework

For convenience, Qt provides a set of standard graphics items for the most common shapes. These are:

All of an item's geometric information is based on its local coordinate system. The item's position, pos(), is the only function that does not operate in local coordinates, as it returns a position in parent coordinates. The Graphics View Coordinate System describes the coordinate system in detail.

You can set whether an item should be visible (i.e., drawn, and accepting events), by calling setVisible(). Hiding an item will also hide its children. Similarly, you can enable or disable an item by calling setEnabled(). If you disable an item, all its children will also be disabled. By default, items are both visible and enabled. To toggle whether an item is selected or not, first enable selection by setting the ItemIsSelectable flag, and then call setSelected(). Normally, selection is toggled by the scene, as a result of user interaction.

To write your own graphics item, you first create a subclass of QGraphicsItem, and then start by implementing its two pure virtual public functions: boundingRect(), which returns an estimate of the area painted by the item, and paint(), which implements the actual painting. For example:

class SimpleItem : public QGraphicsItem
{
public:
    QRectF boundingRect() const override
    {
        qreal penWidth = 1;
        return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
                      20 + penWidth, 20 + penWidth);
    }

    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget) override
    {
        painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
    }
};

The boundingRect() function has many different purposes. QGraphicsScene bases its item index on boundingRect(), and QGraphicsView uses it both for culling invisible items, and for determining the area that needs to be recomposed when drawing overlapping items. In addition, QGraphicsItem's collision detection mechanisms use boundingRect() to provide an efficient cut-off. The fine grained collision algorithm in collidesWithItem() is based on calling shape(), which returns an accurate outline of the item's shape as a QPainterPath.

QGraphicsScene expects all items boundingRect() and shape() to remain unchanged unless it is notified. If you want to change an item's geometry in any way, you must first call prepareGeometryChange() to allow QGraphicsScene to update its bookkeeping.

Collision detection can be done in two ways:

  1. Reimplement shape() to return an accurate shape for your item, and rely on the default implementation of collidesWithItem() to do shape-shape intersection. This can be rather expensive if the shapes are complex.
  2. Reimplement collidesWithItem() to provide your own custom item and shape collision algorithm.

The contains() function can be called to determine whether the item contains a point or not. This function can also be reimplemented by the item. The default behavior of contains() is based on calling shape().

Items can contain other items, and also be contained by other items. All items can have a parent item and a list of children. Unless the item has no parent, its position is in parent coordinates (i.e., the parent's local coordinates). Parent items propagate both their position and their transformation to all children.

Transformations

QGraphicsItem supports projective transformations in addition to its base position, pos(). There are several ways to change an item's transformation. For simple transformations, you can call either of the convenience functions setRotation() or setScale(), or you can pass any transformation matrix to setTransform(). For advanced transformation control you also have the option of setting several combined transformations by calling setTransformations().

Item transformations accumulate from parent to child, so if both a parent and child item are rotated 90 degrees, the child's total transformation will be 180 degrees. Similarly, if the item's parent is scaled to 2x its original size, its children will also be twice as large. An item's transformation does not affect its own local geometry; all geometry functions (e.g., contains(), update(), and all the mapping functions) still operate in local coordinates. For convenience, QGraphicsItem provides the functions sceneTransform(), which returns the item's total transformation matrix (including its position and all parents' positions and transformations), and scenePos(), which returns its position in scene coordinates. To reset an item's matrix, call resetTransform().

Certain transformation operations produce a different outcome depending on the order in which they are applied. For example, if you scale an transform, and then rotate it, you may get a different result than if the transform was rotated first. However, the order you set the transformation properties on QGraphicsItem does not affect the resulting transformation; QGraphicsItem always applies the properties in a fixed, defined order:

Painting

The paint() function is called by QGraphicsView to paint the item's contents. The item has no background or default fill of its own; whatever is behind the item will shine through all areas that are not explicitly painted in this function. You can call update() to schedule a repaint, optionally passing the rectangle that needs a repaint. Depending on whether or not the item is visible in a view, the item may or may not be repainted; there is no equivalent to QWidget::repaint() in QGraphicsItem.

Items are painted by the view, starting with the parent items and then drawing children, in ascending stacking order. You can set an item's stacking order by calling setZValue(), and test it by calling zValue(), where items with low z-values are painted before items with high z-values. Stacking order applies to sibling items; parents are always drawn before their children.

Sorting

All items are drawn in a defined, stable order, and this same order decides which items will receive mouse input first when you click on the scene. Normally you don't have to worry about sorting, as the items follow a "natural order", following the logical structure of the scene.

An item's children are stacked on top of the parent, and sibling items are stacked by insertion order (i.e., in the same order that they were either added to the scene, or added to the same parent). If you add item A, and then B, then B will be on top of A. If you then add C, the items' stacking order will be A, then B, then C.

This example shows the stacking order of all limbs of the robot from the Drag and Drop Robot example. The torso is the root item (all other items are children or descendants of the torso), so it is drawn first. Next, the head is drawn, as it is the first item in the torso's list of children. Then the upper left arm is drawn. As the lower arm is a child of the upper arm, the lower arm is then drawn, followed by the upper arm's next sibling, which is the upper right arm, and so on.

For advanced users, there are ways to alter how your items are sorted:

  • You can call setZValue() on an item to explicitly stack it on top of, or under, other sibling items. The default Z value for an item is 0. Items with the same Z value are stacked by insertion order.
  • You can call stackBefore() to reorder the list of children. This will directly modify the insertion order.
  • You can set the ItemStacksBehindParent flag to stack a child item behind its parent.

The stacking order of two sibling items also counts for each item's children and descendant items. So if one item is on top of another, then all its children will also be on top of all the other item's children as well.

Events

QGraphicsItem receives events from QGraphicsScene through the virtual function sceneEvent(). This function distributes the most common events to a set of convenience event handlers:

You can filter events for any other item by installing event filters. This functionality is separate from Qt's regular event filters (see QObject::installEventFilter()), which only work on subclasses of QObject. After installing your item as an event filter for another item by calling installSceneEventFilter(), the filtered events will be received by the virtual function sceneEventFilter(). You can remove item event filters by calling removeSceneEventFilter().

Custom Data

Sometimes it's useful to register custom data with an item, be it a custom item, or a standard item. You can call setData() on any item to store data in it using a key-value pair (the key being an integer, and the value is a QVariant). To get custom data from an item, call data(). This functionality is completely untouched by Qt itself; it is provided for the user's convenience.

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsitem.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
CacheMode attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
DeviceCoordinateCache attribute Any (shared captured text)
Extension attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
GraphicsItemChange attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
GraphicsItemFlag attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
GraphicsItemFlags attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
ItemAcceptsInputMethod attribute Any (shared captured text)
ItemChildAddedChange attribute Any (shared captured text)
ItemChildRemovedChange attribute Any (shared captured text)
ItemClipsChildrenToShape attribute Any (shared captured text)
ItemClipsToShape attribute Any (shared captured text)
ItemContainsChildrenInShape attribute Any (shared captured text)
ItemCoordinateCache attribute Any (shared captured text)
ItemCursorChange attribute Any (shared captured text)
ItemCursorHasChanged attribute Any (shared captured text)
ItemDoesntPropagateOpacityToChildren attribute Any (shared captured text)
ItemEnabledChange attribute Any (shared captured text)
ItemEnabledHasChanged attribute Any (shared captured text)
ItemFlagsChange attribute Any (shared captured text)
ItemFlagsHaveChanged attribute Any (shared captured text)
ItemHasNoContents attribute Any (shared captured text)
ItemIgnoresParentOpacity attribute Any (shared captured text)
ItemIgnoresTransformations attribute Any (shared captured text)
ItemIsFocusScope attribute Any (shared captured text)
ItemIsFocusable attribute Any (shared captured text)
ItemIsMovable attribute Any (shared captured text)
ItemIsPanel attribute Any (shared captured text)
ItemIsSelectable attribute Any (shared captured text)
ItemMatrixChange attribute Any (shared captured text)
ItemNegativeZStacksBehindParent attribute Any (shared captured text)
ItemOpacityChange attribute Any (shared captured text)
ItemOpacityHasChanged attribute Any (shared captured text)
ItemParentChange attribute Any (shared captured text)
ItemParentHasChanged attribute Any (shared captured text)
ItemPositionChange attribute Any (shared captured text)
ItemPositionHasChanged attribute Any (shared captured text)
ItemRotationChange attribute Any (shared captured text)
ItemRotationHasChanged attribute Any (shared captured text)
ItemScaleChange attribute Any (shared captured text)
ItemScaleHasChanged attribute Any (shared captured text)
ItemSceneChange attribute Any (shared captured text)
ItemSceneHasChanged attribute Any (shared captured text)
ItemScenePositionHasChanged attribute Any (shared captured text)
ItemSelectedChange attribute Any (shared captured text)
ItemSelectedHasChanged attribute Any (shared captured text)
ItemSendsGeometryChanges attribute Any (shared captured text)
ItemSendsScenePositionChanges attribute Any (shared captured text)
ItemStacksBehindParent attribute Any (shared captured text)
ItemStopsClickFocusPropagation attribute Any (shared captured text)
ItemStopsFocusHandling attribute Any (shared captured text)
ItemToolTipChange attribute Any (shared captured text)
ItemToolTipHasChanged attribute Any (shared captured text)
ItemTransformChange attribute Any (shared captured text)
ItemTransformHasChanged attribute Any (shared captured text)
ItemTransformOriginPointChange attribute Any (shared captured text)
ItemTransformOriginPointHasChanged attribute Any (shared captured text)
ItemUsesExtendedStyleOption attribute Any (shared captured text)
ItemVisibleChange attribute Any (shared captured text)
ItemVisibleHasChanged attribute Any (shared captured text)
ItemZValueChange attribute Any (shared captured text)
ItemZValueHasChanged attribute Any (shared captured text)
NoCache attribute Any (shared captured text)
NonModal attribute Any (shared captured text)
PanelModal attribute Any (shared captured text)
PanelModality attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
SceneModal attribute Any (shared captured text)
Type attribute Any (shared captured text)
UserExtension attribute Any (shared captured text)
UserType attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
acceptDrops function (self) -> bool X.acceptDrops() -> bool
acceptHoverEvents function (self) -> bool X.acceptHoverEvents() -> bool
acceptTouchEvents function (self) -> bool X.acceptTouchEvents() -> bool
acceptedMouseButtons function (self) -> Any Returns the mouse buttons that this item accepts mouse events for.
addToIndex function (self) -> None
advance function (self, phase: int) -> None This virtual function is called twice for all items by the [QGraphicsScene::advance](https://doc.qt.io/archives/qt-5.15/qgraphicsscene.html#advance)() slot.
boundingRect function (self) -> Any X.boundingRect() -> PythonQt.QtCore.QRectF
boundingRegion function (self, itemToDeviceTransform: Any) -> Any X.boundingRegion(itemToDeviceTransform) -> PythonQt.QtGui.QRegion
boundingRegionGranularity function (self) -> float X.boundingRegionGranularity() -> float
cacheMode function (self) -> Any Returns the cache mode for this item.
childItems function (self) -> tuple X.childItems() -> tuple
childrenBoundingRect function (self) -> Any X.childrenBoundingRect() -> PythonQt.QtCore.QRectF
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clearFocus function (self) -> None Takes keyboard input focus from the item.
clipPath function (self) -> Any X.clipPath() -> PythonQt.QtGui.QPainterPath
collidesWithItem function (self, other: Any, mode: Any) -> bool X.collidesWithItem(other, mode) -> bool
collidesWithPath function (self, path: Any, mode: Any) -> bool X.collidesWithPath(path, mode) -> bool
collidingItems function (self, mode: Any) -> tuple X.collidingItems(mode) -> tuple
commonAncestorItem function (self, other: Any) -> Any X.commonAncestorItem(other) -> PythonQt.QtGui.QGraphicsItem
contains function (self, point: Any) -> bool X.contains(point) -> bool
contextMenuEvent function (self, event: Any) -> None This event handler can be reimplemented in a subclass to process context menu events.
cursor function (self) -> Any X.cursor() -> PythonQt.QtGui.QCursor
data function (self, key: int) -> Any X.data(key) -> object
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deviceTransform function (self, viewportTransform: Any) -> Any X.deviceTransform(viewportTransform) -> PythonQt.QtGui.QTransform
dragEnterEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive drag enter events for this item.
dragLeaveEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive drag leave events for this item.
dragMoveEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive drag move events for this item.
dropEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive drop events for this item.
effectiveOpacity function (self) -> float X.effectiveOpacity() -> float
ensureVisible function (self, x: Any, y: Any, w: Any, h: Any, xmargin: int, ymargin: int) -> None X.ensureVisible(x, y, w, h, xmargin, ymargin)
enum_1 attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
extension function (self, variant: Any) -> Any X.extension(variant) -> object
filtersChildEvents function (self) -> bool X.filtersChildEvents() -> bool
flags function (self) -> Any Returns this item's flags.
focusInEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive focus in events for this item.
focusItem function (self) -> Any X.focusItem() -> PythonQt.QtGui.QGraphicsItem
focusOutEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive focus out events for this item.
focusProxy function (self) -> Any X.focusProxy() -> PythonQt.QtGui.QGraphicsItem
focusScopeItem function (self) -> Any X.focusScopeItem() -> PythonQt.QtGui.QGraphicsItem
grabKeyboard function (self) -> None Grabs the keyboard input.
grabMouse function (self) -> None Grabs the mouse input.
graphicsEffect function (self) -> Any X.graphicsEffect() -> PythonQt.QtGui.QGraphicsEffect
group function (self) -> Any X.group() -> PythonQt.QtGui.QGraphicsItemGroup
handlesChildEvents function (self) -> bool X.handlesChildEvents() -> bool
hasCursor function (self) -> bool X.hasCursor() -> bool
hasFocus function (self) -> bool X.hasFocus() -> bool
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
hide function (self) -> None Hides the item (items are visible by default).
hoverEnterEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive hover enter events for this item.
hoverLeaveEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive hover leave events for this item.
hoverMoveEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive hover move events for this item.
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
inputMethodEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive input method events for this item.
inputMethodHints function (self) -> Any Returns the current input method hints of this item.
inputMethodQuery function (self, query: Any) -> Any X.inputMethodQuery(query) -> object
installSceneEventFilter function (self, filterItem: Any) -> None Installs an event filter for this item on filterItem, causing all events for this item to first pass through filterItem's…
isActive function (self) -> bool X.isActive() -> bool
isAncestorOf function (self, child: Any) -> bool X.isAncestorOf(child) -> bool
isBlockedByModalPanel function (self, blockingPanel: Any) -> bool X.isBlockedByModalPanel(blockingPanel) -> bool
isClipped function (self) -> bool X.isClipped() -> bool
isEnabled function (self) -> bool X.isEnabled() -> bool
isObscured function (self, x: Any, y: Any, w: Any, h: Any) -> bool X.isObscured(x, y, w, h) -> bool
isObscuredBy function (self, item: Any) -> bool X.isObscuredBy(item) -> bool
isPanel function (self) -> bool X.isPanel() -> bool
isSelected function (self) -> bool X.isSelected() -> bool
isUnderMouse function (self) -> bool X.isUnderMouse() -> bool
isVisible function (self) -> bool X.isVisible() -> bool
isVisibleTo function (self, parent: Any) -> bool X.isVisibleTo(parent) -> bool
isWidget function (self) -> bool X.isWidget() -> bool
isWindow function (self) -> bool X.isWindow() -> bool
itemChange function (self, change: Any, value: Any) -> Any X.itemChange(change, value) -> object
itemTransform function (self, other: Any, ok: Any) -> Any X.itemTransform(other, ok) -> PythonQt.QtGui.QTransform
keyPressEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive key press events for this item.
keyReleaseEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive key release events for this item.
mapFromItem function (self, item: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.mapFromItem(item, x, y, w, h) -> PythonQt.QtGui.QPainterPath
mapFromParent function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapFromParent(x, y, w, h) -> PythonQt.QtGui.QPainterPath
mapFromScene function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapFromScene(x, y, w, h) -> PythonQt.QtGui.QPainterPath
mapRectFromItem function (self, item: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectFromItem(item, x, y, w, h) -> PythonQt.QtCore.QRectF
mapRectFromParent function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectFromParent(x, y, w, h) -> PythonQt.QtCore.QRectF
mapRectFromScene function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectFromScene(x, y, w, h) -> PythonQt.QtCore.QRectF
mapRectToItem function (self, item: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectToItem(item, x, y, w, h) -> PythonQt.QtCore.QRectF
mapRectToParent function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectToParent(x, y, w, h) -> PythonQt.QtCore.QRectF
mapRectToScene function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectToScene(x, y, w, h) -> PythonQt.QtCore.QRectF
mapToItem function (self, item: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.mapToItem(item, x, y, w, h) -> PythonQt.QtGui.QPainterPath
mapToParent function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapToParent(x, y, w, h) -> PythonQt.QtGui.QPainterPath
mapToScene function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapToScene(x, y, w, h) -> PythonQt.QtGui.QPainterPath
mouseDoubleClickEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive mouse double-click events for this item.
mouseMoveEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive mouse move events for this item.
mousePressEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive mouse press events for this item.
mouseReleaseEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive mouse release events for this item.
moveBy function (self, dx: float, dy: float) -> None X.moveBy(dx, dy)
opacity function (self) -> float X.opacity() -> float
opaqueArea function (self) -> Any X.opaqueArea() -> PythonQt.QtGui.QPainterPath
paint function (self, painter: Any, option: Any, widget: Any) -> None X.paint(painter, option, widget)
panel function (self) -> Any X.panel() -> PythonQt.QtGui.QGraphicsItem
panelModality function (self) -> Any Returns the modality for this item.
parentItem function (self) -> Any X.parentItem() -> PythonQt.QtGui.QGraphicsItem
parentObject function (self) -> Any X.parentObject() -> PythonQt.QtGui.QGraphicsObject
parentWidget function (self) -> Any X.parentWidget() -> PythonQt.QtGui.QGraphicsWidget
pos function (self) -> Any X.pos() -> PythonQt.QtCore.QPointF
prepareGeometryChange function (self) -> None Prepares the item for a geometry change.
removeFromIndex function (self) -> None
removeSceneEventFilter function (self, filterItem: Any) -> None Removes an event filter on this item from filterItem.
resetTransform function (self) -> None Resets this item's transformation matrix to the identity matrix or all the transformation properties to their default values.
rotation function (self) -> float X.rotation() -> float
scale function (self) -> float X.scale() -> float
scene function (self) -> Any X.scene() -> PythonQt.QtGui.QGraphicsScene
sceneBoundingRect function (self) -> Any X.sceneBoundingRect() -> PythonQt.QtCore.QRectF
sceneEvent function (self, event: Any) -> bool X.sceneEvent(event) -> bool
sceneEventFilter function (self, watched: Any, event: Any) -> bool X.sceneEventFilter(watched, event) -> bool
scenePos function (self) -> Any X.scenePos() -> PythonQt.QtCore.QPointF
sceneTransform function (self) -> Any X.sceneTransform() -> PythonQt.QtGui.QTransform
scroll function (self, dx: float, dy: float, rect: Any) -> None X.scroll(dx, dy, rect)
setAcceptDrops function (self, on: bool) -> None If on is true, this item will accept drag and drop events; otherwise, it is transparent for drag and drop events.
setAcceptHoverEvents function (self, enabled: bool) -> None If enabled is true, this item will accept hover events; otherwise, it will ignore them.
setAcceptTouchEvents function (self, enabled: bool) -> None If enabled is true, this item will accept [touch events](https://doc.qt.io/archives/qt-5.15/qtouchevent.html); otherwise, it will ignore them.
setAcceptedMouseButtons function (self, buttons: Any) -> None Sets the mouse buttons that this item accepts mouse events for.
setActive function (self, active: bool) -> None If active is true, and the scene is active, this item's panel will be activated.
setBoundingRegionGranularity function (self, granularity: float) -> None Sets the bounding region granularity to granularity; a value between and including 0 and 1.
setCacheMode function (self, mode: Any, cacheSize: Any) -> None X.setCacheMode(mode, cacheSize)
setCursor function (self, cursor: Any) -> None Sets the current cursor shape for the item to cursor.
setData function (self, key: int, value: Any) -> None X.setData(key, value)
setEnabled function (self, enabled: bool) -> None If enabled is true, the item is enabled; otherwise, it is disabled.
setExtension function (self, extension: Any, variant: Any) -> Any X.setExtension(extension, variant) (shared captured text)
setFiltersChildEvents function (self, enabled: bool) -> None If enabled is true, this item is set to filter all events for all its children (i.e., all events intented for any of its children are instead sent to this item); otherwise, if enabled is false,…
setFlag function (self, arg0: flag, enabled: bool) -> None X.setFlag(flag, enabled)
setFlags function (self, arg0: flags) -> None Sets the item flags to flags.
setFocus function (self, focusReason: Any) -> None Gives keyboard input focus to this item.
setFocusProxy function (self, item: Any) -> None Sets the item's focus proxy to item.
setGraphicsEffect function (self, effect: Any) -> None Sets effect as the item's effect.
setGroup function (self, group: Any) -> None Adds this item to the item group group.
setHandlesChildEvents function (self, enabled: bool) -> None
setInputMethodHints function (self, hints: Any) -> None Sets the current input method hints of this item to hints.
setOpacity function (self, opacity: float) -> None Sets this item's local opacity, between 0.0 (transparent) and 1.0 (opaque).
setPanelModality function (self, panelModality: Any) -> None Sets the modality for this item to panelModality.
setParentItem function (self, parent: Any) -> None Sets this item's parent item to newParent.
setPos function (self, x: Any, y: Any) -> None X.setPos(x, y)
setRotation function (self, angle: float) -> None Sets the clockwise rotation angle, in degrees, around the Z axis.
setScale function (self, scale: float) -> None Sets the scale factor of the item.
setSelected function (self, selected: bool) -> None If selected is true and this item is selectable, this item is selected; otherwise, it is unselected.
setToolTip function (self, toolTip: str) -> None Sets the item's tool tip to toolTip.
setTransform function (self, matrix: Any, combine: bool) -> None X.setTransform(matrix, combine)
setTransformOriginPoint function (self, ax: Any, ay: Any) -> None X.setTransformOriginPoint(ax, ay)
setTransformations function (self, transformations: Any) -> None Sets a list of graphics transformations ([QGraphicsTransform](https://doc.qt.io/archives/qt-5.15/qgraphicstransform.html)) that currently apply to this item.
setVisible function (self, visible: bool) -> None If visible is true, the item is made visible.
setX function (self, x: float) -> None Set's the x coordinate of the item's position.
setY function (self, y: float) -> None Set's the y coordinate of the item's position.
setZValue function (self, z: float) -> None Sets the Z-value of the item to z.
shape function (self) -> Any X.shape() -> PythonQt.QtGui.QPainterPath
show function (self) -> None Shows the item (items are visible by default).
stackBefore function (self, sibling: Any) -> None Stacks this item before sibling, which must be a sibling item (i.e., the two items must share the same parent item, or must both be toplevel items).
supportsExtension function (self, extension: Any) -> bool X.supportsExtension(extension) -> bool (shared captured text)
toGraphicsObject function (self) -> Any X.toGraphicsObject() -> PythonQt.QtGui.QGraphicsObject
toolTip function (self) -> str X.toolTip() -> str
topLevelItem function (self) -> Any X.topLevelItem() -> PythonQt.QtGui.QGraphicsItem
topLevelWidget function (self) -> Any X.topLevelWidget() -> PythonQt.QtGui.QGraphicsWidget
transform function (self) -> Any X.transform() -> PythonQt.QtGui.QTransform
transformOriginPoint function (self) -> Any X.transformOriginPoint() -> PythonQt.QtCore.QPointF
transformations function (self) -> tuple X.transformations() -> tuple
type function (self) -> int X.type() -> int
ungrabKeyboard function (self) -> None Releases the keyboard grab.
ungrabMouse function (self) -> None Releases the mouse grab.
unsetCursor function (self) -> None Clears the cursor from this item.
update function (self, x: Any, y: Any, width: Any, height: Any) -> None X.update(x, y, width, height)
updateMicroFocus function (self) -> None Updates the item's micro focus.
wheelEvent function (self, event: Any) -> None This event handler, for event event, can be reimplemented to receive wheel events for this item.
window function (self) -> Any X.window() -> PythonQt.QtGui.QGraphicsWidget
x function (self) -> float X.x() -> float
y function (self) -> float X.y() -> float
zValue function (self) -> float X.zValue() -> float