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

Certain QML Control types do not get active focus on macOS

    XMLWordPrintable

Details

    • macOS

    Description

      2 examples are Button and Slider. They cannot get active focus by clicking/dragging which is the native (default) way of interacting. A simple snippet as example:

      import QtQuick.Controls
      
      ApplicationWindow {
          width: 400
          height: 400
          visible: true
      
          Button {
              text: "Button"
              onActiveFocusChanged: print("activeFocus changed to", activeFocus)
              onPressed: print("pressed")
          }
      }
      

      onActiveFocusChanged is never triggered no matter how it is clicked since the active focus is always false, which can be proved by the output of onPressed. Similar behavior happens to Slider: no matter how it is dragged, it is not focused.

      However text-related Control types, e.g., TextField and TextArea, are not affected. As long as the input box is clicked, they are focused.

      This pattern reminds me of the 'unable to tabbing to Button' issue on macOS as described here:
      https://bugreports.qt.io/browse/QTQAINFRA-4660
      So I tried to set focus by tabbing. And yes, Button and Slider can get focused by tabbing to them. But it is not the native way of interacting with them. It should make more sense to get them focused by clicking/dragging as what Windows and Linux does.

      And so yes, it is an issue on macOS only. Windows and Linux behave as expected.

      Attachments

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

        Activity

          People

            richard Richard Moe Gustavsen
            luqiaochen Luqiao Chen
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes