Qt automatically grabs the mouse when a mouse button is pressed inside a widget; the widget will continue to receive mouse events until the last mouse button is released.
.PP
A mouse event contains a special accept flag that indicates whether the receiver wants the event. You should call QMouseEvent::ignore() if the mouse event is not handled by your widget. A mouse event is propagated up the parent widget chain until a widget accepts it with QMouseEvent::accept() or an event filter consumes it.
.PP
The functions pos(), x() and y() give the cursor position relative to the widget that receives the mouse event. If you move the widget as a result of the mouse event, use the global position returned by globalPos() to avoid a shaking motion.
The \fIpos\fR parameter specifies the position relative to the receiving widget. \fIbutton\fR specifies the button that caused the event, which should be TQt::NoButton (0), if \fItype\fR is MouseMove. \fIstate\fR is the ButtonState at the time of the event.
The \fIpos\fR parameter specifies the position relative to the receiving widget. \fIglobalPos\fR is the position in absolute coordinates. \fIbutton\fR specifies the button that caused the event, which should be TQt::NoButton (0), if \fItype\fR is MouseMove. \fIstate\fR is the ButtonState at the time of the event.
Returns the global position of the mouse pointer \fIat the time of the event\fR. This is important on asynchronous window systems like X11. Whenever you move your widgets around in response to mouse events, globalPos() may differ a lot from the current pointer position QCursor::pos(), and from TQWidget::mapToGlobal( pos() ).
Returns the global x-position of the mouse pointer at the time of the event.
.PP
See also globalY() and globalPos().
.SH "int QMouseEvent::globalY () const"
Returns the global y-position of the mouse pointer at the time of the event.
.PP
See also globalX() and globalPos().
.SH "void QMouseEvent::ignore ()"
Clears the accept flag parameter of the mouse event object.
.PP
Clearing the accept parameter indicates that the event receiver does not want the mouse event. Unwanted mouse events are sent to the parent widget.
.PP
The accept flag is set by default.
.PP
See also accept().
.SH "bool QMouseEvent::isAccepted () const"
Returns TRUE if the receiver of the event wants to keep the key; otherwise returns FALSE.
.SH "const QPoint & QMouseEvent::pos () const"
Returns the position of the mouse pointer relative to the widget that received the event.
.PP
If you move the widget as a result of the mouse event, use the global position returned by globalPos() to avoid a shaking motion.
.PP
See also x(), y(), and globalPos().
.PP
Examples:
.)l chart/canvasview.cpp, drawlines/connect.cpp, life/life.cpp, popup/popup.cpp, qmag/qmag.cpp, t14/cannon.cpp, and tooltip/tooltip.cpp.
.SH "ButtonState QMouseEvent::state () const"
Returns the button state (a combination of mouse buttons and keyboard modifiers), i.e. what buttons and keys were being pressed immediately before the event was generated.
.PP
This means that if you have a QEvent::MouseButtonPress or a QEvent::MouseButtonDblClick state() will \fInot\fR include the mouse button that's pressed. But once the mouse button has been released, the QEvent::MouseButtonRelease event will have the button() that was pressed.
.PP
This value is mainly interesting for QEvent::MouseMove; for the other cases, button() is more useful.
.PP
The returned value is LeftButton, RightButton, MidButton, ShiftButton, ControlButton and AltButton OR'ed together.