Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-74825

Qt Quick mouseMoveEvent() functions need better documentation




      If you read QWidget's mouseMoveEvent() documentation, it's very clear what it's for:

      This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget.

      If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.

      QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.

      If you want to show a tooltip immediately, while the mouse is moving (e.g., to get the mouse coordinates with QMouseEvent::pos() and show them as a tooltip), you must first enable mouse tracking as described above. Then, to ensure that the tooltip is updated immediately, you must call QToolTip::showText() instead of setToolTip() in your implementation of mouseMoveEvent().

      Then read QWindow's:

      Override this to handle mouse move events (ev).

      and QQuickItem's:

      This event handler can be reimplemented in a subclass to receive mouse move events for an item. The event information is provided by the event parameter.

      The event is accepted by default, so it is not necessary to explicitly accept the event if you reimplement this function. If you don't accept the event, call event->ignore().

      There is absolutely no mention of this function only being called when the mouse is pressed. hoverMoveEvent() and friends handle actual hover events, whereas mouseMoveEvent() purely handles movement while the mouse is pressed on an item/window.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            • Assignee:
              docteam Qt Documentation Team
              mitch_curtis Mitch Curtis
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes