HoverEvent

class pyqtgraph.GraphicsScene.mouseEvents.HoverEvent(moveEvent, acceptable)[source]

Instances of this class are delivered to items in a GraphicsScene via their hoverEvent() method when the mouse is hovering over the item. This event class both informs items that the mouse cursor is nearby and allows items to communicate with one another about whether each item will accept potential mouse events.

It is common for multiple overlapping items to receive hover events and respond by changing their appearance. This can be misleading to the user since, in general, only one item will respond to mouse events. To avoid this, items make calls to event.acceptClicks(button) and/or acceptDrags(button).

Each item may make multiple calls to acceptClicks/Drags, each time for a different button. If the method returns True, then the item is guaranteed to be the recipient of the claimed event IF the user presses the specified mouse button before moving. If claimEvent returns False, then this item is guaranteed NOT to get the specified event (because another has already claimed it) and the item should change its appearance accordingly.

event.isEnter() returns True if the mouse has just entered the item’s shape; event.isExit() returns True if the mouse has just left.

acceptClicks(button)[source]

Inform the scene that the item (that the event was delivered to) would accept a mouse click event if the user were to click before moving the mouse again.

Returns True if the request is successful, otherwise returns False (indicating that some other item would receive an incoming click).

acceptDrags(button)[source]

Inform the scene that the item (that the event was delivered to) would accept a mouse drag event if the user were to drag before the next hover event.

Returns True if the request is successful, otherwise returns False (indicating that some other item would receive an incoming drag event).

buttons()[source]

Return the buttons currently pressed on the mouse. (see QGraphicsSceneMouseEvent::buttons in the Qt documentation)

isEnter()[source]

Returns True if the mouse has just entered the item’s shape

isExit()[source]

Returns True if the mouse has just exited the item’s shape

lastPos()[source]

Return the previous position of the mouse in the coordinate system of the item that the event was delivered to.

lastScenePos()[source]

Return the previous scene position of the mouse.

lastScreenPos()[source]

Return the previous screen position of the mouse.

modifiers()[source]

Return any keyboard modifiers currently pressed. (see QGraphicsSceneMouseEvent::modifiers in the Qt documentation)

pos()[source]

Return the current position of the mouse in the coordinate system of the item that the event was delivered to.

scenePos()[source]

Return the current scene position of the mouse.

screenPos()[source]

Return the current screen position of the mouse.