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

[REG 5.15.2->6.1.1] MouseArea hoverEnabled does not enable positionChanged signals in single-threaded windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • None
    • 6.1.1, 6.1.2, 6.2.0 Beta1
    • None
    • Operating System: Ubuntu 20.04.2 LTS
      Architecture: 64 bit
      Window manager: GNOME Version 3.36.8
      Windowing System: X11
    • Linux/X11

    Description

      In version 5.15.2 it was possible to receive positionChanged signals in a single-threaded window by setting hoverEnabled to true within a MouseArea; this does not seem to work in at least Qt 6.1.1 or 6.2.0-beta1.

      The functionality can be demonstrated in version 5.15.2 by starting with the QQuickRenderControl Example (https://doc.qt.io/qt-5/qtquick-rendercontrol-example.html) :

      • download and build the QQuickRenderControl example
      • add a mouseMoveEvent override to window_singlethreaded.h
        void mouseMoveEvent(QMouseEvent * e) override;
      • implement the mouseMoveEvent method in window_singlethreaded.cpp using the existing mousePressEvent and mouseReleaseEvent methods as a guide:
        void WindowSingleThreaded::mouseMoveEvent(QMouseEvent * e)
         {
         QMouseEvent mappedEvent(e->type(), e->localPos(), e->screenPos(), e->button(), e->buttons(), e->modifiers());
         QCoreApplication::sendEvent(m_quickWindow, &mappedEvent);
         }
      • update the MouseArea within demo.qml to set
        hoverEnabled: true

        and to report receipt of positionChanged signals:

        hoverEnabled: true
         onPositionChanged: (event) => { console.log("position: " + event.x + "," + event.y); }

        Expected

      Console log messages are generated as the user moves the mouse over the main window.

      Actual

      The using Qt version 6.1.1 or 6.2.0 no output is generated unless a mouse button is pressed. Qt 5.15.2 generates the expected output.

      Reproduction

      The attached zip file contains projects that have the above changes applied to example code from Qt5.15.2 and similar changes applied to examle code from Qt 6.1.1 and Qt 6.2.0-beta1

      In the Qt 6.x.x examples, pressing and dragging the mouse correctly shows receipt of the positionChanged signal whether hoverEnabled is true or false.

      However, in the Qt6.x.x examples, setting hoverEnabled to true has no effect and the onPositionChanged handler is not triggered unless a button is pressed.

      The problem seems to also affect the containsMouse property and entered and exited signal handling but these are not demonstrated in the attached as I suspect they are effects of the same root cause.

       

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mleadbeater Martin Leadbeater
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes