Skip to content

PythonQt.QtGui.QGraphicsItem · declarations 001

Back to PythonQt.QtGui.QGraphicsItem

acceptDrops

acceptDrops() -> bool

X.acceptDrops() -> bool

Supplemental documentation: Qt 5 reference:

bool QGraphicsItem::acceptDrops() const

Returns true if this item can accept drag and drop events; otherwise, returns false. By default, items do not accept drag and drop events; items are transparent to drag and drop.

See also setAcceptDrops().

Upstream PySide2 reference signatures (binding differences may apply):

acceptDrops(self) -> bool

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

acceptHoverEvents

acceptHoverEvents() -> bool

X.acceptHoverEvents() -> bool

Supplemental documentation: Qt 5 reference:

bool QGraphicsItem::acceptHoverEvents() const

Returns true if an item accepts hover events (QGraphicsSceneHoverEvent); otherwise, returns false. By default, items do not accept hover events.

This function was introduced in Qt 4.4.

See also setAcceptHoverEvents() and setAcceptedMouseButtons().

Upstream PySide2 reference signatures (binding differences may apply):

acceptHoverEvents(self) -> bool

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

acceptTouchEvents

acceptTouchEvents() -> bool

X.acceptTouchEvents() -> bool

Supplemental documentation: Qt 5 reference:

bool QGraphicsItem::acceptTouchEvents() const

Returns true if an item accepts touch events; otherwise, returns false. By default, items do not accept touch events.

This function was introduced in Qt 4.6.

See also setAcceptTouchEvents().

Upstream PySide2 reference signatures (binding differences may apply):

acceptTouchEvents(self) -> bool

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

acceptedMouseButtons

acceptedMouseButtons() -> Any

X.acceptedMouseButtons()

Supplemental documentation: Qt 5 reference:

Qt::MouseButtons QGraphicsItem::acceptedMouseButtons() const

Returns the mouse buttons that this item accepts mouse events for. By default, all mouse buttons are accepted.

If an item accepts a mouse button, it will become the mouse grabber item when a mouse press event is delivered for that mouse button. However, if the item does not accept the button, QGraphicsScene will forward the mouse events to the first item beneath it that does.

See also setAcceptedMouseButtons() and mousePressEvent().

Upstream PySide2 reference signatures (binding differences may apply):

acceptedMouseButtons(self) -> PySide2.QtCore.Qt.MouseButtons

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

addToIndex

addToIndex() -> None

X.addToIndex()

Upstream PySide2 reference signatures (binding differences may apply):

addToIndex(self) -> None

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

advance

advance(phase: int) -> None

X.advance(phase)

Supplemental documentation: Qt 5 reference:

[virtual] void QGraphicsItem::advance(int phase)

This virtual function is called twice for all items by the QGraphicsScene::advance() slot. In the first phase, all items are called with phase \=\= 0, indicating that items on the scene are about to advance, and then all items are called with phase \=\= 1. Reimplement this function to update your item if you need simple scene-controlled animation.

The default implementation does nothing.

This function is intended for animations. An alternative is to multiple-inherit from QObject and QGraphicsItem and use the Animation Framework.

See also QGraphicsScene::advance() and QTimeLine.

Upstream PySide2 reference signatures (binding differences may apply):

advance(self, phase: int) -> None

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

boundingRect

boundingRect() -> Any

X.boundingRect() -> PythonQt.QtCore.QRectF

Supplemental documentation: Qt 5 reference:

[pure virtual] QRectF QGraphicsItem::boundingRect() const

This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be restricted to inside an item's bounding rect. QGraphicsView uses this to determine whether the item requires redrawing.

Although the item's shape can be arbitrary, the bounding rect is always rectangular, and it is unaffected by the items' transformation.

If you want to change the item's bounding rectangle, you must first call prepareGeometryChange(). This notifies the scene of the imminent change, so that it can update its item geometry index; otherwise, the scene will be unaware of the item's new geometry, and the results are undefined (typically, rendering artifacts are left within the view).

Reimplement this function to let QGraphicsView determine what parts of the widget, if any, need to be redrawn.

Note: For shapes that paint an outline / stroke, it is important to include half the pen width in the bounding rect. It is not necessary to compensate for antialiasing, though.

Example:

QRectF CircleItem::boundingRect() const
{
    qreal penWidth = 1;
    return QRectF(-radius - penWidth / 2, -radius - penWidth / 2,
                  diameter + penWidth, diameter + penWidth);
}

See also boundingRegion(), shape(), contains(), The Graphics View Coordinate System, and prepareGeometryChange().

Upstream PySide2 reference signatures (binding differences may apply):

boundingRect(self) -> PySide2.QtCore.QRectF

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

boundingRegion

boundingRegion(itemToDeviceTransform: Any) -> Any

X.boundingRegion(itemToDeviceTransform) -> PythonQt.QtGui.QRegion

Supplemental documentation: Qt 5 reference:

QRegion QGraphicsItem::boundingRegion(const QTransform \&itemToDeviceTransform) const

Returns the bounding region for this item. The coordinate space of the returned region depends on itemToDeviceTransform. If you pass an identity QTransform as a parameter, this function will return a local coordinate region.

The bounding region describes a coarse outline of the item's visual contents. Although it's expensive to calculate, it's also more precise than boundingRect(), and it can help to avoid unnecessary repainting when an item is updated. This is particularly efficient for thin items (e.g., lines or simple polygons). You can tune the granularity for the bounding region by calling setBoundingRegionGranularity(). The default granularity is 0; in which the item's bounding region is the same as its bounding rect.

itemToDeviceTransform is the transformation from item coordinates to device coordinates. If you want this function to return a QRegion in scene coordinates, you can pass sceneTransform() as an argument.

This function was introduced in Qt 4.4.

See also boundingRegionGranularity().

Upstream PySide2 reference signatures (binding differences may apply):

boundingRegion(self, itemToDeviceTransform: PySide2.QtGui.QTransform) -> PySide2.QtGui.QRegion

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

boundingRegionGranularity

boundingRegionGranularity() -> float

X.boundingRegionGranularity() -> float

Supplemental documentation: Qt 5 reference:

qreal QGraphicsItem::boundingRegionGranularity() const

Returns the item's bounding region granularity; a value between and including 0 and 1. The default value is 0 (i.e., the lowest granularity, where the bounding region corresponds to the item's bounding rectangle).

This function was introduced in Qt 4.4.

See also setBoundingRegionGranularity().

Upstream PySide2 reference signatures (binding differences may apply):

boundingRegionGranularity(self) -> float

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

cacheMode

cacheMode() -> Any

X.cacheMode()

Supplemental documentation: Qt 5 reference:

QGraphicsItem::CacheMode QGraphicsItem::cacheMode() const

Returns the cache mode for this item. The default mode is NoCache (i.e., cache is disabled and all painting is immediate).

This function was introduced in Qt 4.4.

See also setCacheMode().

Upstream PySide2 reference signatures (binding differences may apply):

cacheMode(self) -> PySide2.QtWidgets.QGraphicsItem.CacheMode

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

childItems

childItems() -> tuple

X.childItems() -> tuple

Supplemental documentation: Qt 5 reference:

QList\<QGraphicsItem *> QGraphicsItem::childItems() const

Returns a list of this item's children.

The items are sorted by stacking order. This takes into account both the items' insertion order and their Z-values.

This function was introduced in Qt 4.4.

See also setParentItem(), zValue(), and Sorting.

Upstream PySide2 reference signatures (binding differences may apply):

childItems(self) -> typing.List[PySide2.QtWidgets.QGraphicsItem]

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

childrenBoundingRect

childrenBoundingRect() -> Any

X.childrenBoundingRect() -> PythonQt.QtCore.QRectF

Supplemental documentation: Qt 5 reference:

QRectF QGraphicsItem::childrenBoundingRect() const

Returns the bounding rect of this item's descendants (i.e., its children, their children, etc.) in local coordinates. The rectangle will contain all descendants after they have been mapped to local coordinates. If the item has no children, this function returns an empty QRectF.

This does not include this item's own bounding rect; it only returns its descendants' accumulated bounding rect. If you need to include this item's bounding rect, you can add boundingRect() to childrenBoundingRect() using QRectF::operator|().

This function is linear in complexity; it determines the size of the returned bounding rect by iterating through all descendants.

See also boundingRect() and sceneBoundingRect().

Upstream PySide2 reference signatures (binding differences may apply):

childrenBoundingRect(self) -> PySide2.QtCore.QRectF

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

clearFocus

clearFocus() -> None

X.clearFocus()

Supplemental documentation: Qt 5 reference:

void QGraphicsItem::clearFocus()

Takes keyboard input focus from the item.

If it has focus, a focus out event is sent to this item to tell it that it is about to lose the focus.

Only items that set the ItemIsFocusable flag, or widgets that set an appropriate focus policy, can accept keyboard focus.

See also setFocus(), hasFocus(), and QGraphicsWidget::focusPolicy.

Upstream PySide2 reference signatures (binding differences may apply):

clearFocus(self) -> None

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

clipPath

clipPath() -> Any

X.clipPath() -> PythonQt.QtGui.QPainterPath

Supplemental documentation: Qt 5 reference:

QPainterPath QGraphicsItem::clipPath() const

Returns this item's clip path, or an empty QPainterPath if this item is not clipped. The clip path constrains the item's appearance and interaction (i.e., restricts the area the item can draw within and receive events for).

You can enable clipping by setting the ItemClipsToShape or ItemClipsChildrenToShape flags. The item's clip path is calculated by intersecting all clipping ancestors' shapes. If the item sets ItemClipsToShape, the final clip is intersected with the item's own shape.

Note: Clipping introduces a performance penalty for all items involved; you should generally avoid using clipping if you can (e.g., if your items always draw inside boundingRect() or shape() boundaries, clipping is not necessary).

This function was introduced in Qt 4.5.

See also isClipped(), shape(), and setFlags().

Upstream PySide2 reference signatures (binding differences may apply):

clipPath(self) -> PySide2.QtGui.QPainterPath

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

collidesWithItem

collidesWithItem(other: Any, mode: Any) -> bool

X.collidesWithItem(other, mode) -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QGraphicsItem::collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode \= Qt::IntersectsItemShape) const

Returns true if this item collides with other; otherwise returns false.

The mode is applied to other, and the resulting shape or bounding rectangle is then compared to this item's shape. The default value for mode is Qt::IntersectsItemShape; other collides with this item if it either intersects, contains, or is contained by this item's shape (see Qt::ItemSelectionMode for details).

The default implementation is based on shape intersection, and it calls shape() on both items. Because the complexity of arbitrary shape-shape intersection grows with an order of magnitude when the shapes are complex, this operation can be noticeably time-consuming. You have the option of reimplementing this function in a subclass of QGraphicsItem to provide a custom algorithm. This allows you to make use of natural constraints in the shapes of your own items, in order to improve the performance of the collision detection. For instance, two untransformed perfectly circular items' collision can be determined very efficiently by comparing their positions and radii.

Keep in mind that when reimplementing this function and calling shape() or boundingRect() on other, the returned coordinates must be mapped to this item's coordinate system before any intersection can take place.

See also contains() and shape().

Upstream PySide2 reference signatures (binding differences may apply):

collidesWithItem(self, other: PySide2.QtWidgets.QGraphicsItem, mode: PySide2.QtCore.Qt.ItemSelectionMode=...) -> bool

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

collidesWithPath

collidesWithPath(path: Any, mode: Any) -> bool

X.collidesWithPath(path, mode) -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QGraphicsItem::collidesWithPath(const QPainterPath \&path, Qt::ItemSelectionMode mode \= Qt::IntersectsItemShape) const

Returns true if this item collides with path.

The collision is determined by mode. The default value for mode is Qt::IntersectsItemShape; path collides with this item if it either intersects, contains, or is contained by this item's shape.

Note that this function checks whether the item's shape or bounding rectangle (depending on mode) is contained within path, and not whether path is contained within the items shape or bounding rectangle.

See also collidesWithItem(), contains(), and shape().

Upstream PySide2 reference signatures (binding differences may apply):

collidesWithPath(self, path: PySide2.QtGui.QPainterPath, mode: PySide2.QtCore.Qt.ItemSelectionMode=...) -> bool

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

collidingItems

collidingItems(mode: Any) -> tuple

X.collidingItems(mode) -> tuple

Supplemental documentation: Qt 5 reference:

QList\<QGraphicsItem *> QGraphicsItem::collidingItems(Qt::ItemSelectionMode mode \= Qt::IntersectsItemShape) const

Returns a list of all items that collide with this item.

The way collisions are detected is determined by applying mode to items that are compared to this item, i.e., each item's shape or bounding rectangle is checked against this item's shape. The default value for mode is Qt::IntersectsItemShape.

See also collidesWithItem().

Upstream PySide2 reference signatures (binding differences may apply):

collidingItems(self, mode: PySide2.QtCore.Qt.ItemSelectionMode=...) -> typing.List[PySide2.QtWidgets.QGraphicsItem]

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

commonAncestorItem

commonAncestorItem(other: Any) -> Any

X.commonAncestorItem(other) -> PythonQt.QtGui.QGraphicsItem

Supplemental documentation: Qt 5 reference:

QGraphicsItem *QGraphicsItem::commonAncestorItem(const QGraphicsItem *other) const

Returns the closest common ancestor item of this item and other, or nullptr if either other is nullptr, or there is no common ancestor.

This function was introduced in Qt 4.4.

See also isAncestorOf().

Upstream PySide2 reference signatures (binding differences may apply):

commonAncestorItem(self, other: PySide2.QtWidgets.QGraphicsItem) -> PySide2.QtWidgets.QGraphicsItem

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

contains

contains(point: Any) -> bool

X.contains(point) -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QGraphicsItem::contains(const QPointF \&point) const

Returns true if this item contains point, which is in local coordinates; otherwise, false is returned. It is most often called from QGraphicsView to determine what item is under the cursor, and for that reason, the implementation of this function should be as light-weight as possible.

By default, this function calls shape(), but you can reimplement it in a subclass to provide a (perhaps more efficient) implementation.

See also shape(), boundingRect(), and collidesWithPath().

Upstream PySide2 reference signatures (binding differences may apply):

contains(self, point: PySide2.QtCore.QPointF) -> bool

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

contextMenuEvent

contextMenuEvent(event: Any) -> None

X.contextMenuEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QGraphicsItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)

This event handler can be reimplemented in a subclass to process context menu events. The event parameter contains details about the event to be handled.

If you ignore the event (i.e., by calling QEvent::ignore()), event will propagate to any item beneath this item. If no items accept the event, it will be ignored by the scene and propagate to the view.

It's common to open a QMenu in response to receiving a context menu event. Example:

void CustomItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
    QMenu menu;
    QAction *removeAction = menu.addAction("Remove");
    QAction *markAction = menu.addAction("Mark");
    QAction *selectedAction = menu.exec(event->screenPos());
    // ...
}

The default implementation ignores the event.

See also sceneEvent().

Upstream PySide2 reference signatures (binding differences may apply):

contextMenuEvent(self, event: PySide2.QtWidgets.QGraphicsSceneContextMenuEvent) -> None

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

cursor

cursor() -> Any

X.cursor() -> PythonQt.QtGui.QCursor

Supplemental documentation: Qt 5 reference:

QCursor QGraphicsItem::cursor() const

Returns the current cursor shape for the item. The mouse cursor will assume this shape when it's over this item. See the list of predefined cursor objects for a range of useful shapes.

An editor item might want to use an I-beam cursor:

item->setCursor(Qt::IBeamCursor);

If no cursor has been set, the cursor of the item beneath is used.

See also setCursor(), hasCursor(), unsetCursor(), QWidget::cursor, and QGuiApplication::overrideCursor().

Upstream PySide2 reference signatures (binding differences may apply):

cursor(self) -> PySide2.QtGui.QCursor

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

data

data(key: int) -> Any

X.data(key) -> object

Supplemental documentation: Qt 5 reference:

QVariant QGraphicsItem::data(int key) const

Returns this item's custom data for the key key as a QVariant.

Custom item data is useful for storing arbitrary properties in any item. Example:

static const int ObjectName = 0;

QGraphicsItem *item = scene.itemAt(100, 50);
if (item->data(ObjectName).toString().isEmpty()) {
    if (qgraphicsitem_cast<ButtonItem *>(item))
        item->setData(ObjectName, "Button");
}

Qt does not use this feature for storing data; it is provided solely for the convenience of the user.

See also setData().

Upstream PySide2 reference signatures (binding differences may apply):

data(self, key: int) -> typing.Any

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

deviceTransform

deviceTransform(viewportTransform: Any) -> Any

X.deviceTransform(viewportTransform) -> PythonQt.QtGui.QTransform

Supplemental documentation: Qt 5 reference:

QTransform QGraphicsItem::deviceTransform(const QTransform \&viewportTransform) const

Returns this item's device transformation matrix, using viewportTransform to map from scene to device coordinates. This matrix can be used to map coordinates and geometrical shapes from this item's local coordinate system to the viewport's (or any device's) coordinate system. To map coordinates from the viewport, you must first invert the returned matrix.

Example:

QGraphicsRectItem rect;
rect.setPos(100, 100);

rect.deviceTransform(view->viewportTransform()).map(QPointF(0, 0));
// returns the item's (0, 0) point in view's viewport coordinates

rect.deviceTransform(view->viewportTransform()).inverted().map(QPointF(100, 100));
// returns view's viewport's (100, 100) coordinate in item coordinates

This function is the same as combining this item's scene transform with the view's viewport transform, but it also understands the ItemIgnoresTransformations flag. The device transform can be used to do accurate coordinate mapping (and collision detection) for untransformable items.

This function was introduced in Qt 4.3.

See also transform(), setTransform(), scenePos(), The Graphics View Coordinate System, and itemTransform().

Upstream PySide2 reference signatures (binding differences may apply):

deviceTransform(self, viewportTransform: PySide2.QtGui.QTransform) -> PySide2.QtGui.QTransform

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

dragEnterEvent

dragEnterEvent(event: Any) -> None

X.dragEnterEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QGraphicsItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event)

This event handler, for event event, can be reimplemented to receive drag enter events for this item. Drag enter events are generated as the cursor enters the item's area.

By accepting the event (i.e., by calling QEvent::accept()), the item will accept drop events, in addition to receiving drag move and drag leave. Otherwise, the event will be ignored and propagate to the item beneath. If the event is accepted, the item will receive a drag move event before control goes back to the event loop.

A common implementation of dragEnterEvent accepts or ignores event depending on the associated mime data in event. Example:

CustomItem::CustomItem()
{
    setAcceptDrops(true);
    ...
}

void CustomItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
    event->setAccepted(event->mimeData()->hasFormat("text/plain"));
}

Items do not receive drag and drop events by default; to enable this feature, call setAcceptDrops(true).

The default implementation does nothing.

See also dropEvent(), dragMoveEvent(), and dragLeaveEvent().

Upstream PySide2 reference signatures (binding differences may apply):

dragEnterEvent(self, event: PySide2.QtWidgets.QGraphicsSceneDragDropEvent) -> None

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

dragLeaveEvent

dragLeaveEvent(event: Any) -> None

X.dragLeaveEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QGraphicsItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)

This event handler, for event event, can be reimplemented to receive drag leave events for this item. Drag leave events are generated as the cursor leaves the item's area. Most often you will not need to reimplement this function, but it can be useful for resetting state in your item (e.g., highlighting).

Calling QEvent::ignore() or QEvent::accept() on event has no effect.

Items do not receive drag and drop events by default; to enable this feature, call setAcceptDrops(true).

The default implementation does nothing.

See also dragEnterEvent(), dropEvent(), and dragMoveEvent().

Upstream PySide2 reference signatures (binding differences may apply):

dragLeaveEvent(self, event: PySide2.QtWidgets.QGraphicsSceneDragDropEvent) -> None

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

dragMoveEvent

dragMoveEvent(event: Any) -> None

X.dragMoveEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QGraphicsItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event)

This event handler, for event event, can be reimplemented to receive drag move events for this item. Drag move events are generated as the cursor moves around inside the item's area. Most often you will not need to reimplement this function; it is used to indicate that only parts of the item can accept drops.

Calling QEvent::ignore() or QEvent::accept() on event toggles whether or not the item will accept drops at the position from the event. By default, event is accepted, indicating that the item allows drops at the specified position.

Items do not receive drag and drop events by default; to enable this feature, call setAcceptDrops(true).

The default implementation does nothing.

See also dropEvent(), dragEnterEvent(), and dragLeaveEvent().

Upstream PySide2 reference signatures (binding differences may apply):

dragMoveEvent(self, event: PySide2.QtWidgets.QGraphicsSceneDragDropEvent) -> None

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

dropEvent

dropEvent(event: Any) -> None

X.dropEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QGraphicsItem::dropEvent(QGraphicsSceneDragDropEvent *event)

This event handler, for event event, can be reimplemented to receive drop events for this item. Items can only receive drop events if the last drag move event was accepted.

Calling QEvent::ignore() or QEvent::accept() on event has no effect.

Items do not receive drag and drop events by default; to enable this feature, call setAcceptDrops(true).

The default implementation does nothing.

See also dragEnterEvent(), dragMoveEvent(), and dragLeaveEvent().

Upstream PySide2 reference signatures (binding differences may apply):

dropEvent(self, event: PySide2.QtWidgets.QGraphicsSceneDragDropEvent) -> None

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

effectiveOpacity

effectiveOpacity() -> float

X.effectiveOpacity() -> float

Supplemental documentation: Qt 5 reference:

qreal QGraphicsItem::effectiveOpacity() const

Returns this item's effective opacity, which is between 0.0 (transparent) and 1.0 (opaque). This value is a combination of this item's local opacity, and its parent and ancestors' opacities. The effective opacity decides how the item is rendered.

This function was introduced in Qt 4.5.

See also opacity(), setOpacity(), paint(), ItemIgnoresParentOpacity, and ItemDoesntPropagateOpacityToChildren.

Upstream PySide2 reference signatures (binding differences may apply):

effectiveOpacity(self) -> float

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

ensureVisible

ensureVisible(x: Any, y: Any, w: Any, h: Any, xmargin: int, ymargin: int) -> None

X.ensureVisible(x, y, w, h, xmargin, ymargin)

Supplemental documentation: Qt 5 reference:

void QGraphicsItem::ensureVisible(const QRectF \&rect \= QRectF(), int xmargin \= 50, int ymargin \= 50)

If this item is part of a scene that is viewed by a QGraphicsView, this convenience function will attempt to scroll the view to ensure that rect is visible inside the view's viewport. If rect is a null rect (the default), QGraphicsItem will default to the item's bounding rect. xmargin and ymargin are the number of pixels the view should use for margins.

If the specified rect cannot be reached, the contents are scrolled to the nearest valid position.

If this item is not viewed by a QGraphicsView, this function does nothing.

See also QGraphicsView::ensureVisible().

void QGraphicsItem::ensureVisible(qreal x, qreal y, qreal w, qreal h, int xmargin \= 50, int ymargin \= 50)

This convenience function is equivalent to calling ensureVisible(QRectF(x, y, w, h), xmargin, ymargin).

Upstream PySide2 reference signatures (binding differences may apply):

ensureVisible(self, rect: PySide2.QtCore.QRectF=..., xmargin: int=..., ymargin: int=...) -> None
ensureVisible(self, x: float, y: float, w: float, h: float, xmargin: int=..., ymargin: int=...) -> None

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

extension

extension(variant: Any) -> Any

X.extension(variant) -> object

Upstream PySide2 reference signatures (binding differences may apply):

extension(self, variant: typing.Any) -> typing.Any

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

filtersChildEvents

filtersChildEvents() -> bool

X.filtersChildEvents() -> bool

Supplemental documentation: Qt 5 reference:

bool QGraphicsItem::filtersChildEvents() const

Returns true if this item filters child events (i.e., all events intended for any of its children are instead sent to this item); otherwise, false is returned.

The default value is false; child events are not filtered.

This function was introduced in Qt 4.6.

See also setFiltersChildEvents().

Upstream PySide2 reference signatures (binding differences may apply):

filtersChildEvents(self) -> bool

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

flags

flags() -> Any

X.flags()

Supplemental documentation: Qt 5 reference:

QGraphicsItem::GraphicsItemFlags QGraphicsItem::flags() const

Returns this item's flags. The flags describe what configurable features of the item are enabled and not. For example, if the flags include ItemIsFocusable, the item can accept input focus.

By default, no flags are enabled.

See also setFlags() and setFlag().

Upstream PySide2 reference signatures (binding differences may apply):

flags(self) -> PySide2.QtWidgets.QGraphicsItem.GraphicsItemFlags

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

focusInEvent

focusInEvent(event: Any) -> None

X.focusInEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QGraphicsItem::focusInEvent(QFocusEvent *event)

This event handler, for event event, can be reimplemented to receive focus in events for this item. The default implementation calls ensureVisible().

See also focusOutEvent(), sceneEvent(), and setFocus().

Upstream PySide2 reference signatures (binding differences may apply):

focusInEvent(self, event: PySide2.QtGui.QFocusEvent) -> None

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

focusItem

focusItem() -> Any

X.focusItem() -> PythonQt.QtGui.QGraphicsItem

Supplemental documentation: Qt 5 reference:

QGraphicsItem *QGraphicsItem::focusItem() const

If this item, a child or descendant of this item currently has input focus, this function will return a pointer to that item. If no descendant has input focus, nullptr is returned.

This function was introduced in Qt 4.6.

See also hasFocus(), setFocus(), and QWidget::focusWidget().

Upstream PySide2 reference signatures (binding differences may apply):

focusItem(self) -> PySide2.QtWidgets.QGraphicsItem

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

focusOutEvent

focusOutEvent(event: Any) -> None

X.focusOutEvent(event)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QGraphicsItem::focusOutEvent(QFocusEvent *event)

This event handler, for event event, can be reimplemented to receive focus out events for this item. The default implementation does nothing.

See also focusInEvent(), sceneEvent(), and setFocus().

Upstream PySide2 reference signatures (binding differences may apply):

focusOutEvent(self, event: PySide2.QtGui.QFocusEvent) -> None

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

focusProxy

focusProxy() -> Any

X.focusProxy() -> PythonQt.QtGui.QGraphicsItem

Supplemental documentation: Qt 5 reference:

QGraphicsItem *QGraphicsItem::focusProxy() const

Returns this item's focus proxy, or nullptr if this item has no focus proxy.

This function was introduced in Qt 4.6.

See also setFocusProxy(), setFocus(), and hasFocus().

Upstream PySide2 reference signatures (binding differences may apply):

focusProxy(self) -> PySide2.QtWidgets.QGraphicsItem

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

focusScopeItem

focusScopeItem() -> Any

X.focusScopeItem() -> PythonQt.QtGui.QGraphicsItem

Upstream PySide2 reference signatures (binding differences may apply):

focusScopeItem(self) -> PySide2.QtWidgets.QGraphicsItem

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

grabKeyboard

grabKeyboard() -> None

X.grabKeyboard()

Supplemental documentation: Qt 5 reference:

void QGraphicsItem::grabKeyboard()

Grabs the keyboard input.

The item will receive all keyboard input to the scene until one of the following events occur:

  • The item becomes invisible
  • The item is removed from the scene
  • The item is deleted
  • The item calls ungrabKeyboard()
  • Another item calls grabKeyboard(); the item will regain the keyboard grab when the other item calls ungrabKeyboard().

When an item gains the keyboard grab, it receives a QEvent::GrabKeyboard event. When it loses the keyboard grab, it receives a QEvent::UngrabKeyboard event. These events can be used to detect when your item gains or loses the keyboard grab through other means than gaining input focus.

It is almost never necessary to explicitly grab the keyboard in Qt, as Qt grabs and releases it sensibly. In particular, Qt grabs the keyboard when your item gains input focus, and releases it when your item loses input focus, or when the item is hidden.

Note that only visible items can grab keyboard input. Calling grabKeyboard() on an invisible item has no effect.

Keyboard events are not affected.

This function was introduced in Qt 4.4.

See also ungrabKeyboard(), grabMouse(), and setFocus().

Upstream PySide2 reference signatures (binding differences may apply):

grabKeyboard(self) -> None

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

grabMouse

grabMouse() -> None

X.grabMouse()

Supplemental documentation: Qt 5 reference:

void QGraphicsItem::grabMouse()

Grabs the mouse input.

This item will receive all mouse events for the scene until any of the following events occurs:

  • The item becomes invisible
  • The item is removed from the scene
  • The item is deleted
  • The item call ungrabMouse()
  • Another item calls grabMouse(); the item will regain the mouse grab when the other item calls ungrabMouse().

When an item gains the mouse grab, it receives a QEvent::GrabMouse event. When it loses the mouse grab, it receives a QEvent::UngrabMouse event. These events can be used to detect when your item gains or loses the mouse grab through other means than receiving mouse button events.

It is almost never necessary to explicitly grab the mouse in Qt, as Qt grabs and releases it sensibly. In particular, Qt grabs the mouse when you press a mouse button, and keeps the mouse grabbed until you release the last mouse button. Also, Qt::Popup widgets implicitly call grabMouse() when shown, and ungrabMouse() when hidden.

Note that only visible items can grab mouse input. Calling grabMouse() on an invisible item has no effect.

Keyboard events are not affected.

This function was introduced in Qt 4.4.

See also QGraphicsScene::mouseGrabberItem(), ungrabMouse(), and grabKeyboard().

Upstream PySide2 reference signatures (binding differences may apply):

grabMouse(self) -> None

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

graphicsEffect

graphicsEffect() -> Any

X.graphicsEffect() -> PythonQt.QtGui.QGraphicsEffect

Supplemental documentation: Qt 5 reference:

QGraphicsEffect *QGraphicsItem::graphicsEffect() const

Returns a pointer to this item's effect if it has one; otherwise nullptr.

This function was introduced in Qt 4.6.

See also setGraphicsEffect().

Upstream PySide2 reference signatures (binding differences may apply):

graphicsEffect(self) -> PySide2.QtWidgets.QGraphicsEffect

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