Skip to content

PythonQt.QtGui.QGraphicsItemGroup

QGraphicsItemGroup

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

A QGraphicsItemGroup is a special type of compound item that treats itself and all its children as one item (i.e., all events and geometries for all children are merged together). It's common to use item groups in presentation tools, when the user wants to group several smaller items into one big item in order to simplify moving and copying of items.

If all you want is to store items inside other items, you can use any QGraphicsItem directly by passing a suitable parent to setParentItem().

The boundingRect() function of QGraphicsItemGroup returns the bounding rectangle of all items in the item group. QGraphicsItemGroup ignores the ItemIgnoresTransformations flag on its children (i.e., with respect to the geometry of the group item, the children are treated as if they were transformable).

There are two ways to construct an item group. The easiest and most common approach is to pass a list of items (e.g., all selected items) to QGraphicsScene::createItemGroup(), which returns a new QGraphicsItemGroup item. The other approach is to manually construct a QGraphicsItemGroup item, add it to the scene calling QGraphicsScene::addItem(), and then add items to the group manually, one at a time by calling addToGroup(). To dismantle ("ungroup") an item group, you can either call QGraphicsScene::destroyItemGroup(), or you can manually remove all items from the group by calling removeFromGroup().

// Group all selected items together
QGraphicsItemGroup *group = scene->createItemGroup(scene->selecteditems());

// Destroy the group, and delete the group item
scene->destroyItemGroup(group);

The operation of adding and removing items preserves the items' scene-relative position and transformation, as opposed to calling setParentItem(), where only the child item's parent-relative position and transformation are kept.

The addtoGroup() function reparents the target item to this item group, keeping the item's position and transformation intact relative to the scene. Visually, this means that items added via addToGroup() will remain completely unchanged as a result of this operation, regardless of the item or the group's current position or transformation; although the item's position and matrix are likely to change.

The removeFromGroup() function has similar semantics to setParentItem(); it reparents the item to the parent item of the item group. As with addToGroup(), the item's scene-relative position and transformation remain intact.

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsitemgroup.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 (shared captured text)
acceptHoverEvents function (self) -> bool X.acceptHoverEvents() -> bool (shared captured text)
acceptTouchEvents function (self) -> bool X.acceptTouchEvents() -> bool (shared captured text)
acceptedMouseButtons function (self) -> Any (shared captured text)
addToGroup function (self, item: Any) -> None Adds the given item and item's child items to this item group.
addToIndex function (self) -> Any (shared captured text)
advance function (self, phase: Any) -> Any (shared captured text)
boundingRect function (self) -> Any X.boundingRect() -> PythonQt.QtCore.QRectF
boundingRegion function (self, itemToDeviceTransform: Any) -> Any X.boundingRegion(itemToDeviceTransform) -> PythonQt.QtGui.QRegion (shared captured text)
boundingRegionGranularity function (self) -> float X.boundingRegionGranularity() -> float (shared captured text)
cacheMode function (self) -> Any (shared captured text)
childItems function (self) -> tuple X.childItems() -> tuple (shared captured text)
childrenBoundingRect function (self) -> Any X.childrenBoundingRect() -> PythonQt.QtCore.QRectF (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clearFocus function (self) -> Any (shared captured text)
clipPath function (self) -> Any X.clipPath() -> PythonQt.QtGui.QPainterPath (shared captured text)
collidesWithItem function (self, other: Any, mode: Any) -> bool X.collidesWithItem(other, mode) -> bool (shared captured text)
collidesWithPath function (self, path: Any, mode: Any) -> bool X.collidesWithPath(path, mode) -> bool (shared captured text)
collidingItems function (self, mode: Any) -> tuple X.collidingItems(mode) -> tuple (shared captured text)
commonAncestorItem function (self, other: Any) -> Any X.commonAncestorItem(other) -> PythonQt.QtGui.QGraphicsItem (shared captured text)
contains function (self, point: Any) -> bool X.contains(point) -> bool (shared captured text)
contextMenuEvent function (self, event: Any) -> Any (shared captured text)
cursor function (self) -> Any X.cursor() -> PythonQt.QtGui.QCursor (shared captured text)
data function (self, key: Any) -> Any X.data(key) -> object (shared captured text)
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 (shared captured text)
dragEnterEvent function (self, event: Any) -> Any (shared captured text)
dragLeaveEvent function (self, event: Any) -> Any (shared captured text)
dragMoveEvent function (self, event: Any) -> Any (shared captured text)
dropEvent function (self, event: Any) -> Any (shared captured text)
effectiveOpacity function (self) -> float X.effectiveOpacity() -> float (shared captured text)
ensureVisible function (self, x: Any, y: Any, w: Any, h: Any, xmargin: Any, ymargin: Any) -> Any X.ensureVisible(x, y, w, h, xmargin, ymargin) (shared captured text)
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 (shared captured text)
filtersChildEvents function (self) -> bool X.filtersChildEvents() -> bool (shared captured text)
flags function (self) -> Any (shared captured text)
focusInEvent function (self, event: Any) -> Any (shared captured text)
focusItem function (self) -> Any X.focusItem() -> PythonQt.QtGui.QGraphicsItem (shared captured text)
focusOutEvent function (self, event: Any) -> Any (shared captured text)
focusProxy function (self) -> Any X.focusProxy() -> PythonQt.QtGui.QGraphicsItem (shared captured text)
focusScopeItem function (self) -> Any X.focusScopeItem() -> PythonQt.QtGui.QGraphicsItem (shared captured text)
grabKeyboard function (self) -> Any (shared captured text)
grabMouse function (self) -> Any (shared captured text)
graphicsEffect function (self) -> Any X.graphicsEffect() -> PythonQt.QtGui.QGraphicsEffect (shared captured text)
group function (self) -> Any X.group() -> PythonQt.QtGui.QGraphicsItemGroup (shared captured text)
handlesChildEvents function (self) -> bool X.handlesChildEvents() -> bool (shared captured text)
hasCursor function (self) -> bool X.hasCursor() -> bool (shared captured text)
hasFocus function (self) -> bool X.hasFocus() -> bool (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
hide function (self) -> Any (shared captured text)
hoverEnterEvent function (self, event: Any) -> Any (shared captured text)
hoverLeaveEvent function (self, event: Any) -> Any (shared captured text)
hoverMoveEvent function (self, event: Any) -> Any (shared captured text)
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) -> Any (shared captured text)
inputMethodHints function (self) -> Any (shared captured text)
inputMethodQuery function (self, query: Any) -> Any X.inputMethodQuery(query) -> object (shared captured text)
installSceneEventFilter function (self, filterItem: Any) -> Any (shared captured text)
isActive function (self) -> bool X.isActive() -> bool (shared captured text)
isAncestorOf function (self, child: Any) -> bool X.isAncestorOf(child) -> bool (shared captured text)
isBlockedByModalPanel function (self, blockingPanel: Any) -> bool X.isBlockedByModalPanel(blockingPanel) -> bool (shared captured text)
isClipped function (self) -> bool X.isClipped() -> bool (shared captured text)
isEnabled function (self) -> bool X.isEnabled() -> bool (shared captured text)
isObscured function (self, x: Any, y: Any, w: Any, h: Any) -> bool X.isObscured(x, y, w, h) -> bool (shared captured text)
isObscuredBy function (self, item: Any) -> bool X.isObscuredBy(item) -> bool
isPanel function (self) -> bool X.isPanel() -> bool (shared captured text)
isSelected function (self) -> bool X.isSelected() -> bool (shared captured text)
isUnderMouse function (self) -> bool X.isUnderMouse() -> bool (shared captured text)
isVisible function (self) -> bool X.isVisible() -> bool (shared captured text)
isVisibleTo function (self, parent: Any) -> bool X.isVisibleTo(parent) -> bool (shared captured text)
isWidget function (self) -> bool X.isWidget() -> bool (shared captured text)
isWindow function (self) -> bool X.isWindow() -> bool (shared captured text)
itemChange function (self, change: Any, value: Any) -> Any X.itemChange(change, value) -> object (shared captured text)
itemTransform function (self, other: Any, ok: Any) -> Any X.itemTransform(other, ok) -> PythonQt.QtGui.QTransform (shared captured text)
keyPressEvent function (self, event: Any) -> Any (shared captured text)
keyReleaseEvent function (self, event: Any) -> Any (shared captured text)
mapFromItem function (self, item: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.mapFromItem(item, x, y, w, h) -> PythonQt.QtGui.QPainterPath (shared captured text)
mapFromParent function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapFromParent(x, y, w, h) -> PythonQt.QtGui.QPainterPath (shared captured text)
mapFromScene function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapFromScene(x, y, w, h) -> PythonQt.QtGui.QPainterPath (shared captured text)
mapRectFromItem function (self, item: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectFromItem(item, x, y, w, h) -> PythonQt.QtCore.QRectF (shared captured text)
mapRectFromParent function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectFromParent(x, y, w, h) -> PythonQt.QtCore.QRectF (shared captured text)
mapRectFromScene function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectFromScene(x, y, w, h) -> PythonQt.QtCore.QRectF (shared captured text)
mapRectToItem function (self, item: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectToItem(item, x, y, w, h) -> PythonQt.QtCore.QRectF (shared captured text)
mapRectToParent function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectToParent(x, y, w, h) -> PythonQt.QtCore.QRectF (shared captured text)
mapRectToScene function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapRectToScene(x, y, w, h) -> PythonQt.QtCore.QRectF (shared captured text)
mapToItem function (self, item: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.mapToItem(item, x, y, w, h) -> PythonQt.QtGui.QPainterPath (shared captured text)
mapToParent function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapToParent(x, y, w, h) -> PythonQt.QtGui.QPainterPath (shared captured text)
mapToScene function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.mapToScene(x, y, w, h) -> PythonQt.QtGui.QPainterPath (shared captured text)
mouseDoubleClickEvent function (self, event: Any) -> Any (shared captured text)
mouseMoveEvent function (self, event: Any) -> Any (shared captured text)
mousePressEvent function (self, event: Any) -> Any (shared captured text)
mouseReleaseEvent function (self, event: Any) -> Any (shared captured text)
moveBy function (self, dx: Any, dy: Any) -> Any X.moveBy(dx, dy) (shared captured text)
opacity function (self) -> float X.opacity() -> float (shared captured text)
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 (shared captured text)
panelModality function (self) -> Any (shared captured text)
parentItem function (self) -> Any X.parentItem() -> PythonQt.QtGui.QGraphicsItem (shared captured text)
parentObject function (self) -> Any X.parentObject() -> PythonQt.QtGui.QGraphicsObject (shared captured text)
parentWidget function (self) -> Any X.parentWidget() -> PythonQt.QtGui.QGraphicsWidget (shared captured text)
pos function (self) -> Any X.pos() -> PythonQt.QtCore.QPointF (shared captured text)
prepareGeometryChange function (self) -> Any (shared captured text)
removeFromGroup function (self, item: Any) -> None Removes the specified item from this group.
removeFromIndex function (self) -> Any (shared captured text)
removeSceneEventFilter function (self, filterItem: Any) -> Any (shared captured text)
resetTransform function (self) -> Any (shared captured text)
rotation function (self) -> float X.rotation() -> float (shared captured text)
scale function (self) -> float X.scale() -> float (shared captured text)
scene function (self) -> Any X.scene() -> PythonQt.QtGui.QGraphicsScene (shared captured text)
sceneBoundingRect function (self) -> Any X.sceneBoundingRect() -> PythonQt.QtCore.QRectF (shared captured text)
sceneEvent function (self, event: Any) -> bool X.sceneEvent(event) -> bool (shared captured text)
sceneEventFilter function (self, watched: Any, event: Any) -> bool X.sceneEventFilter(watched, event) -> bool (shared captured text)
scenePos function (self) -> Any X.scenePos() -> PythonQt.QtCore.QPointF (shared captured text)
sceneTransform function (self) -> Any X.sceneTransform() -> PythonQt.QtGui.QTransform (shared captured text)
scroll function (self, dx: Any, dy: Any, rect: Any) -> Any X.scroll(dx, dy, rect) (shared captured text)
setAcceptDrops function (self, on: Any) -> Any (shared captured text)
setAcceptHoverEvents function (self, enabled: Any) -> Any (shared captured text)
setAcceptTouchEvents function (self, enabled: Any) -> Any (shared captured text)
setAcceptedMouseButtons function (self, buttons: Any) -> Any (shared captured text)
setActive function (self, active: Any) -> Any (shared captured text)
setBoundingRegionGranularity function (self, granularity: Any) -> Any (shared captured text)
setCacheMode function (self, mode: Any, cacheSize: Any) -> Any X.setCacheMode(mode, cacheSize) (shared captured text)
setCursor function (self, cursor: Any) -> Any (shared captured text)
setData function (self, key: Any, value: Any) -> Any X.setData(key, value) (shared captured text)
setEnabled function (self, enabled: Any) -> Any (shared captured text)
setExtension function (self, extension: Any, variant: Any) -> Any X.setExtension(extension, variant) (shared captured text)
setFiltersChildEvents function (self, enabled: Any) -> Any (shared captured text)
setFlag function (self, arg0: flag, enabled: Any) -> Any X.setFlag(flag, enabled) (shared captured text)
setFlags function (self, arg0: flags) -> Any (shared captured text)
setFocus function (self, focusReason: Any) -> Any (shared captured text)
setFocusProxy function (self, item: Any) -> Any (shared captured text)
setGraphicsEffect function (self, effect: Any) -> Any (shared captured text)
setGroup function (self, group: Any) -> Any (shared captured text)
setHandlesChildEvents function (self, enabled: Any) -> Any (shared captured text)
setInputMethodHints function (self, hints: Any) -> Any (shared captured text)
setOpacity function (self, opacity: Any) -> Any (shared captured text)
setPanelModality function (self, panelModality: Any) -> Any (shared captured text)
setParentItem function (self, parent: Any) -> Any (shared captured text)
setPos function (self, x: Any, y: Any) -> Any X.setPos(x, y) (shared captured text)
setRotation function (self, angle: Any) -> Any (shared captured text)
setScale function (self, scale: Any) -> Any (shared captured text)
setSelected function (self, selected: Any) -> Any (shared captured text)
setToolTip function (self, toolTip: Any) -> Any (shared captured text)
setTransform function (self, matrix: Any, combine: Any) -> Any X.setTransform(matrix, combine) (shared captured text)
setTransformOriginPoint function (self, ax: Any, ay: Any) -> Any X.setTransformOriginPoint(ax, ay) (shared captured text)
setTransformations function (self, transformations: Any) -> Any (shared captured text)
setVisible function (self, visible: Any) -> Any (shared captured text)
setX function (self, x: Any) -> Any (shared captured text)
setY function (self, y: Any) -> Any (shared captured text)
setZValue function (self, z: Any) -> Any (shared captured text)
shape function (self) -> Any X.shape() -> PythonQt.QtGui.QPainterPath (shared captured text)
show function (self) -> Any (shared captured text)
stackBefore function (self, sibling: Any) -> Any (shared captured text)
supportsExtension function (self, extension: Any) -> bool X.supportsExtension(extension) -> bool (shared captured text)
toGraphicsObject function (self) -> Any X.toGraphicsObject() -> PythonQt.QtGui.QGraphicsObject (shared captured text)
toolTip function (self) -> str X.toolTip() -> str (shared captured text)
topLevelItem function (self) -> Any X.topLevelItem() -> PythonQt.QtGui.QGraphicsItem (shared captured text)
topLevelWidget function (self) -> Any X.topLevelWidget() -> PythonQt.QtGui.QGraphicsWidget (shared captured text)
transform function (self) -> Any X.transform() -> PythonQt.QtGui.QTransform (shared captured text)
transformOriginPoint function (self) -> Any X.transformOriginPoint() -> PythonQt.QtCore.QPointF (shared captured text)
transformations function (self) -> tuple X.transformations() -> tuple (shared captured text)
type function (self) -> int X.type() -> int
ungrabKeyboard function (self) -> Any (shared captured text)
ungrabMouse function (self) -> Any (shared captured text)
unsetCursor function (self) -> Any (shared captured text)
update function (self, x: Any, y: Any, width: Any, height: Any) -> Any X.update(x, y, width, height) (shared captured text)
updateMicroFocus function (self) -> Any (shared captured text)
wheelEvent function (self, event: Any) -> Any (shared captured text)
window function (self) -> Any X.window() -> PythonQt.QtGui.QGraphicsWidget (shared captured text)
x function (self) -> float X.x() -> float (shared captured text)
y function (self) -> float X.y() -> float (shared captured text)
zValue function (self) -> float X.zValue() -> float (shared captured text)