QHoverEvent¶
The
QHoverEvent
class contains parameters that describe a mouse event. More…
Synopsis¶
Functions¶
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, whileoldPos()
gives the old mouse position.There are a few similarities between the events
HoverEnter
andHoverLeave
, and the eventsEnter
andLeave
. However, they are slightly different because we do an update() in the event handler ofHoverEnter
andHoverLeave
.
HoverMove
is also slightly different fromMouseMove
. 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 theWA_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 PySide2.QtGui.QHoverEvent(type, pos, oldPos[, modifiers=Qt.NoModifier])¶
- param type:
- param modifiers:
KeyboardModifiers
- param pos:
- param oldPos:
Constructs a hover event object.
The
type
parameter must beHoverEnter
,HoverLeave
, orHoverMove
.The
pos
is the current mouse cursor’s position relative to the receiving widget, whileoldPos
is its previous such position.modifiers
hold the state of all keyboard modifiers at the time of the event.
- PySide2.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, will return the same position as
pos()
.On
HoverEnter
events, this position will always beQPoint
(-1, -1).See also
- PySide2.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, will return the same position as
posF()
.On
HoverEnter
events, this position will always beQPointF
(-1, -1).See also
- PySide2.QtGui.QHoverEvent.pos()¶
- Return type:
Returns the position of the mouse cursor, relative to the widget that received the event.
On
HoverLeave
events, this position will always beQPoint
(-1, -1).See also
- PySide2.QtGui.QHoverEvent.posF()¶
- Return type:
Returns the position of the mouse cursor, relative to the widget that received the event.
On
HoverLeave
events, this position will always beQPointF
(-1, -1).See also
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.