CopperSpice API
1.9.2
|
The QHoverEvent class contains parameters which describe a mouse event. More...
Public Methods | |
QHoverEvent (Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers=Qt::NoModifier) | |
QPoint | oldPos () const |
const QPointF & | oldPosF () const |
QPoint | pos () const |
const QPointF & | posF () const |
Public Methods inherited from QInputEvent | |
Qt::KeyboardModifiers | modifiers () const |
void | setModifiers (Qt::KeyboardModifiers modifiers) |
void | setTimestamp (ulong timestamp) |
ulong | timestamp () const |
Public Methods inherited from QEvent | |
QEvent (const QEvent &other) | |
QEvent (Type type) | |
virtual | ~QEvent () |
void | accept () |
void | ignore () |
bool | isAccepted () const |
QEvent & | operator= (const QEvent &other) |
void | setAccepted (bool accepted) |
bool | spontaneous () const |
Type | type () const |
Additional Inherited Members | |
Public Types inherited from QEvent | |
enum | Type |
Static Public Methods inherited from QEvent | |
static int | registerEventType (int hint=-1) |
The QHoverEvent class contains parameters which describe a mouse event. Mouse events occur when a mouse cursor is moved into, out of, or within a widget, and if the widget has the Qt::WA_Hover attribute. The method pos() gives the current cursor position, while oldPos() gives the old mouse position.
There are a few similarities between the events QEvent::HoverEnter and QEvent::HoverLeave, and the events QEvent::Enter and QEvent::Leave. However, they are slightly different because we do an update() in the event handler of HoverEnter and HoverLeave. QEvent::HoverMove is also slightly different from QEvent::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):
If you move the cursor from the top to the bottom in the middle of A, you will get the following QEvent::MouseMove events:
You will get the same events for QEvent::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 Qt::WA_NoMousePropagation attribute.
In this case the events will occur in the following way:
QHoverEvent::QHoverEvent | ( | Type | type, |
const QPointF & | pos, | ||
const QPointF & | oldPos, | ||
Qt::KeyboardModifiers | modifiers = Qt::NoModifier |
||
) |
Constructs a hover event object.
The type parameter must be QEvent::HoverEnter, QEvent::HoverLeave, or QEvent::HoverMove. The pos is the current mouse cursor's position relative to the receiving widget, while oldPos is the previous such position. The modifiers hold the state of all keyboard modifiers at the time of the event.
|
inline |
|
inline |
|
inline |