Struct GraphicsItemChange

Source
pub struct GraphicsItemChange(/* private fields */);
Expand description

This enum describes the state changes that are notified by QGraphicsItem::itemChange(). The notifications are sent as the state changes, and in some cases, adjustments can be made (see the documentation for each change for details).

C++ enum: QGraphicsItem::GraphicsItemChange.

C++ documentation:

This enum describes the state changes that are notified by QGraphicsItem::itemChange(). The notifications are sent as the state changes, and in some cases, adjustments can be made (see the documentation for each change for details).

Note: Be careful with calling functions on the QGraphicsItem itself inside itemChange(), as certain function calls can lead to unwanted recursion. For example, you cannot call setPos() in itemChange() on an ItemPositionChange notification, as the setPos() function will again call itemChange(ItemPositionChange). Instead, you can return the new, adjusted position from itemChange().

Implementations§

Source§

impl GraphicsItemChange

Source

pub fn to_int(&self) -> c_int

Source§

impl GraphicsItemChange

Source

pub const ItemPositionChange: GraphicsItemChange

The item’s position changes. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and when the item’s local position changes, relative to its parent (i.e., as a result of calling setPos() or moveBy()). The value argument is the new position (i.e., a QPointF). You can call pos() to get the original position. Do not call setPos() or moveBy() in itemChange() as this notification is delivered; instead, you can return the new, adjusted position from itemChange(). After this notification, QGraphicsItem immediately sends the ItemPositionHasChanged notification if the position changed. (C++ enum variant: ItemPositionChange = 0)

Source

pub const ItemMatrixChange: GraphicsItemChange

The item’s affine transformation matrix is changing. This value is obsolete; you can use ItemTransformChange instead. (C++ enum variant: ItemMatrixChange = 1)

Source

pub const ItemVisibleChange: GraphicsItemChange

The item’s visible state changes. If the item is presently visible, it will become invisible, and vice verca. The value argument is the new visible state (i.e., true or false). Do not call setVisible() in itemChange() as this notification is delivered; instead, you can return the new visible state from itemChange(). (C++ enum variant: ItemVisibleChange = 2)

Source

pub const ItemEnabledChange: GraphicsItemChange

The item’s enabled state changes. If the item is presently enabled, it will become disabled, and vice verca. The value argument is the new enabled state (i.e., true or false). Do not call setEnabled() in itemChange() as this notification is delivered. Instead, you can return the new state from itemChange(). (C++ enum variant: ItemEnabledChange = 3)

Source

pub const ItemSelectedChange: GraphicsItemChange

The item’s selected state changes. If the item is presently selected, it will become unselected, and vice verca. The value argument is the new selected state (i.e., true or false). Do not call setSelected() in itemChange() as this notification is delivered; instead, you can return the new selected state from itemChange(). (C++ enum variant: ItemSelectedChange = 4)

Source

pub const ItemParentChange: GraphicsItemChange

The item’s parent changes. The value argument is the new parent item (i.e., a QGraphicsItem pointer). Do not call setParentItem() in itemChange() as this notification is delivered; instead, you can return the new parent from itemChange(). (C++ enum variant: ItemParentChange = 5)

Source

pub const ItemChildAddedChange: GraphicsItemChange

A child is added to this item. The value argument is the new child item (i.e., a QGraphicsItem pointer). Do not pass this item to any item’s setParentItem() function as this notification is delivered. The return value is unused; you cannot adjust anything in this notification. Note that the new child might not be fully constructed when this notification is sent; calling pure virtual functions on the child can lead to a crash. (C++ enum variant: ItemChildAddedChange = 6)

Source

pub const ItemChildRemovedChange: GraphicsItemChange

A child is removed from this item. The value argument is the child item that is about to be removed (i.e., a QGraphicsItem pointer). The return value is unused; you cannot adjust anything in this notification. (C++ enum variant: ItemChildRemovedChange = 7)

Source

pub const ItemTransformChange: GraphicsItemChange

The item’s transformation matrix changes. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and when the item’s local transformation matrix changes (i.e., as a result of calling setTransform(). The value argument is the new matrix (i.e., a QTransform); to get the old matrix, call transform(). Do not call setTransform() or set any of the transformation properties in itemChange() as this notification is delivered; instead, you can return the new matrix from itemChange(). This notification is not sent if you change the transformation properties. (C++ enum variant: ItemTransformChange = 8)

Source

pub const ItemPositionHasChanged: GraphicsItemChange

The item’s position has changed. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and after the item’s local position, relative to its parent, has changed. The value argument is the new position (the same as pos()), and QGraphicsItem ignores the return value for this notification (i.e., a read-only notification). (C++ enum variant: ItemPositionHasChanged = 9)

Source

pub const ItemTransformHasChanged: GraphicsItemChange

The item’s transformation matrix has changed either because setTransform is called, or one of the transformation properties is changed. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and after the item’s local transformation matrix has changed. The value argument is the new matrix (same as transform()), and QGraphicsItem ignores the return value for this notification (i.e., a read-only notification). (C++ enum variant: ItemTransformHasChanged = 10)

Source

pub const ItemSceneChange: GraphicsItemChange

The item is moved to a new scene. This notification is also sent when the item is added to its initial scene, and when it is removed. The item’s scene() is the old scene (or 0 if the item has not been added to a scene yet). The value argument is the new scene (i.e., a QGraphicsScene pointer), or a null pointer if the item is removed from a scene. Do not override this change by passing this item to QGraphicsScene::addItem() as this notification is delivered; instead, you can return the new scene from itemChange(). Use this feature with caution; objecting to a scene change can quickly lead to unwanted recursion. (C++ enum variant: ItemSceneChange = 11)

Source

pub const ItemVisibleHasChanged: GraphicsItemChange

The item’s visible state has changed. The value argument is the new visible state (i.e., true or false). Do not call setVisible() in itemChange() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemVisibleHasChanged = 12)

Source

pub const ItemEnabledHasChanged: GraphicsItemChange

The item’s enabled state has changed. The value argument is the new enabled state (i.e., true or false). Do not call setEnabled() in itemChange() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemEnabledHasChanged = 13)

Source

pub const ItemSelectedHasChanged: GraphicsItemChange

The item’s selected state has changed. The value argument is the new selected state (i.e., true or false). Do not call setSelected() in itemChange() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemSelectedHasChanged = 14)

Source

pub const ItemParentHasChanged: GraphicsItemChange

The item’s parent has changed. The value argument is the new parent (i.e., a pointer to a QGraphicsItem). Do not call setParentItem() in itemChange() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemParentHasChanged = 15)

Source

pub const ItemSceneHasChanged: GraphicsItemChange

The item’s scene has changed. The item’s scene() is the new scene. This notification is also sent when the item is added to its initial scene, and when it is removed.The value argument is the new scene (i.e., a pointer to a QGraphicsScene). Do not call setScene() in itemChange() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemSceneHasChanged = 16)

Source

pub const ItemCursorChange: GraphicsItemChange

The item’s cursor changes. The value argument is the new cursor (i.e., a QCursor). Do not call setCursor() in itemChange() as this notification is delivered. Instead, you can return a new cursor from itemChange(). (C++ enum variant: ItemCursorChange = 17)

Source

pub const ItemCursorHasChanged: GraphicsItemChange

The item’s cursor has changed. The value argument is the new cursor (i.e., a QCursor). Do not call setCursor() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemCursorHasChanged = 18)

Source

pub const ItemToolTipChange: GraphicsItemChange

The item’s tooltip changes. The value argument is the new tooltip (i.e., a QToolTip). Do not call setToolTip() in itemChange() as this notification is delivered. Instead, you can return a new tooltip from itemChange(). (C++ enum variant: ItemToolTipChange = 19)

Source

pub const ItemToolTipHasChanged: GraphicsItemChange

The item’s tooltip has changed. The value argument is the new tooltip (i.e., a QToolTip). Do not call setToolTip() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemToolTipHasChanged = 20)

Source

pub const ItemFlagsChange: GraphicsItemChange

The item’s flags change. The value argument is the new flags (i.e., a quint32). Do not call setFlags() in itemChange() as this notification is delivered. Instead, you can return the new flags from itemChange(). (C++ enum variant: ItemFlagsChange = 21)

Source

pub const ItemFlagsHaveChanged: GraphicsItemChange

The item’s flags have changed. The value argument is the new flags (i.e., a quint32). Do not call setFlags() in itemChange() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemFlagsHaveChanged = 22)

Source

pub const ItemZValueChange: GraphicsItemChange

The item’s Z-value changes. The value argument is the new Z-value (i.e., a double). Do not call setZValue() in itemChange() as this notification is delivered. Instead, you can return a new Z-value from itemChange(). (C++ enum variant: ItemZValueChange = 23)

Source

pub const ItemZValueHasChanged: GraphicsItemChange

The item’s Z-value has changed. The value argument is the new Z-value (i.e., a double). Do not call setZValue() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemZValueHasChanged = 24)

Source

pub const ItemOpacityChange: GraphicsItemChange

The item’s opacity changes. The value argument is the new opacity (i.e., a double). Do not call setOpacity() in itemChange() as this notification is delivered. Instead, you can return a new opacity from itemChange(). (C++ enum variant: ItemOpacityChange = 25)

Source

pub const ItemOpacityHasChanged: GraphicsItemChange

The item’s opacity has changed. The value argument is the new opacity (i.e., a double). Do not call setOpacity() as this notification is delivered. The return value is ignored. (C++ enum variant: ItemOpacityHasChanged = 26)

Source

pub const ItemScenePositionHasChanged: GraphicsItemChange

The item’s scene position has changed. This notification is sent if the ItemSendsScenePositionChanges flag is enabled, and after the item’s scene position has changed (i.e., the position or transformation of the item itself or the position or transformation of any ancestor has changed). The value argument is the new scene position (the same as scenePos()), and QGraphicsItem ignores the return value for this notification (i.e., a read-only notification). (C++ enum variant: ItemScenePositionHasChanged = 27)

Source

pub const ItemRotationChange: GraphicsItemChange

The item’s rotation property changes. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and when the item’s rotation property changes (i.e., as a result of calling setRotation()). The value argument is the new rotation (i.e., a double); to get the old rotation, call rotation(). Do not call setRotation() in itemChange() as this notification is delivered; instead, you can return the new rotation from itemChange(). (C++ enum variant: ItemRotationChange = 28)

Source

pub const ItemRotationHasChanged: GraphicsItemChange

The item’s rotation property has changed. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and after the item’s rotation property has changed. The value argument is the new rotation (i.e., a double), and QGraphicsItem ignores the return value for this notification (i.e., a read-only notification). Do not call setRotation() in itemChange() as this notification is delivered. (C++ enum variant: ItemRotationHasChanged = 29)

Source

pub const ItemScaleChange: GraphicsItemChange

The item’s scale property changes. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and when the item’s scale property changes (i.e., as a result of calling setScale()). The value argument is the new scale (i.e., a double); to get the old scale, call scale(). Do not call setScale() in itemChange() as this notification is delivered; instead, you can return the new scale from itemChange(). (C++ enum variant: ItemScaleChange = 30)

Source

pub const ItemScaleHasChanged: GraphicsItemChange

The item’s scale property has changed. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and after the item’s scale property has changed. The value argument is the new scale (i.e., a double), and QGraphicsItem ignores the return value for this notification (i.e., a read-only notification). Do not call setScale() in itemChange() as this notification is delivered. (C++ enum variant: ItemScaleHasChanged = 31)

Source

pub const ItemTransformOriginPointChange: GraphicsItemChange

The item’s transform origin point property changes. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and when the item’s transform origin point property changes (i.e., as a result of calling setTransformOriginPoint()). The value argument is the new origin point (i.e., a QPointF); to get the old origin point, call transformOriginPoint(). Do not call setTransformOriginPoint() in itemChange() as this notification is delivered; instead, you can return the new transform origin point from itemChange(). (C++ enum variant: ItemTransformOriginPointChange = 32)

Source

pub const ItemTransformOriginPointHasChanged: GraphicsItemChange

The item’s transform origin point property has changed. This notification is sent if the ItemSendsGeometryChanges flag is enabled, and after the item’s transform origin point property has changed. The value argument is the new origin point (i.e., a QPointF), and QGraphicsItem ignores the return value for this notification (i.e., a read-only notification). Do not call setTransformOriginPoint() in itemChange() as this notification is delivered. (C++ enum variant: ItemTransformOriginPointHasChanged = 33)

Trait Implementations§

Source§

impl Clone for GraphicsItemChange

Source§

fn clone(&self) -> GraphicsItemChange

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GraphicsItemChange

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<GraphicsItemChange> for c_int

Source§

fn from(value: GraphicsItemChange) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for GraphicsItemChange

Source§

fn from(value: c_int) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for GraphicsItemChange

Source§

fn eq(&self, other: &GraphicsItemChange) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for GraphicsItemChange

Source§

impl Eq for GraphicsItemChange

Source§

impl StructuralPartialEq for GraphicsItemChange

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

Source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> StaticUpcast<T> for T

Source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.