QHoverEvent#
The QHoverEvent
class contains parameters that describe a mouse event. More…
Synopsis#
Functions#
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
Mouse events occur when a mouse cursor is moved into, out of, or within a widget, and if the widget has the WA_Hover
attribute.
The function pos() gives the current cursor position, while oldPos()
gives the old mouse position.
There are a few similarities between the events HoverEnter
and HoverLeave
, and the events Enter
and Leave
. However, they are slightly different because we do an update() in the event handler of HoverEnter and HoverLeave.
HoverMove
is also slightly different from MouseMove
. Let us consider a top-level window A containing a child B which in turn contains a child C (all with mouse tracking enabled):
Now, if you move the cursor from the top to the bottom in the middle of A, you will get the following MouseMove
events:
A::MouseMove
B::MouseMove
C::MouseMove
You will get the same events for HoverMove
, except that the event always propagates to the top-level regardless whether the event is accepted or not. It will only stop propagating with the WA_NoMousePropagation
attribute.
In this case the events will occur in the following way:
A::HoverMove
A::HoverMove, B::HoverMove
A::HoverMove, B::HoverMove, C::HoverMove
- class PySide6.QtGui.QHoverEvent(type, pos, oldPos[, modifiers=Qt.NoModifier[, device=QPointingDevice.primaryPointingDevice()]])#
Note
This constructor is deprecated.
PySide6.QtGui.QHoverEvent(type, scenePos, globalPos, oldPos[, modifiers=Qt.NoModifier[, device=QPointingDevice.primaryPointingDevice()]])
PySide6.QtGui.QHoverEvent(arg__1)
- Parameters:
arg__1 –
PySide6.QtGui.QHoverEvent
scenePos –
PySide6.QtCore.QPointF
globalPos –
PySide6.QtCore.QPointF
modifiers –
KeyboardModifiers
type –
Type
oldPos –
PySide6.QtCore.QPointF
device –
PySide6.QtGui.QPointingDevice
pos –
PySide6.QtCore.QPointF
Use the other constructor instead (global position is required).
Constructs a hover event object originating from device
.
The type
parameter must be HoverEnter
, HoverLeave
, or HoverMove
.
The pos
is the current mouse cursor’s position relative to the receiving widget, while oldPos
is its previous such position. modifiers
hold the state of all keyboard modifiers at the time of the event.
Constructs a hover event object originating from device
.
The type
parameter must be HoverEnter
, HoverLeave
, or HoverMove
.
The scenePos
is the current mouse cursor’s position relative to the receiving window or scene, oldPos
is its previous such position, and globalPos
is the mouse position in absolute coordinates. modifiers
hold the state of all keyboard modifiers at the time of the event.
- PySide6.QtGui.QHoverEvent.oldPos()#
- Return type:
Returns the previous position of the mouse cursor, relative to the widget that received the event. If there is no previous position, oldPos() will return the same position as pos().
On HoverEnter
events, this position will always be QPoint
(-1, -1).
See also
- PySide6.QtGui.QHoverEvent.oldPosF()#
- Return type:
Returns the previous position of the mouse cursor, relative to the widget that received the event. If there is no previous position, oldPosF() will return the same position as posF().
On HoverEnter
events, this position will always be QPointF
(-1, -1).
See also
- PySide6.QtGui.QHoverEvent.pos()#
- Return type:
Note
This function is deprecated.
Use position()
.toPoint() instead.
Returns the position of the mouse cursor, relative to the widget that received the event.
On HoverLeave
events, this position will always be QPoint
(-1, -1).
See also
- PySide6.QtGui.QHoverEvent.posF()#
- Return type:
Note
This function is deprecated.
Use position()
instead.
Returns the position of the mouse cursor, relative to the widget that received the event.
On HoverLeave
events, this position will always be QPointF
(-1, -1).
See also