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

focusReason set by ListView::keyNavigationEnabled property is inconsistent with KeyNavigation type

    XMLWordPrintable

Details

    • All

    Description

      Controls react differently to various focusReason causes. Usually they get more prominent highlight or outline when focusReason is one of those which make the read-only visualFocus property turn on: Qt.TabFocusReason, Qt.BacktabFocusReason, or Qt.ShortcutFocusReason.

      KeyNavigation attached type, to my big surprise, sets Tab and Backtab reasons for all of its interactions, be it really Tab/BackTab button or arrow keys. It might not be 100% semantically correct (at least by the name of it), but it works in a way that is supported by the Control::visualFocus property, so I'm happy with it.

      ListView, on the other hand, has its own internal arrow keys handling and exposes keyNavigationEnabled property to toggle that. Unfortunately, key presses handled by this mechanism sets a generic Qt.OtherFocusReason status, which is both inconsistent with similarly named KeyNavigation API, and does not deliver nice visuals due to visualFocus being off.

      Stack trace

      1. https://github.com/qt/qtdeclarative/blob/6.5.0/src/quick/items/qquicklistview.cpp#L3484
      2. https://github.com/qt/qtdeclarative/blob/6.5.0/src/quick/items/qquicklistview.cpp#L3578
      3. https://github.com/qt/qtdeclarative/blob/6.5.0/src/quick/items/qquickitemview.cpp#L289
      4. https://github.com/qt/qtdeclarative/blob/6.5.0/src/quick/items/qquickitemview.cpp#L1656

      Suggestion

      Fix ListView::keyNavigationEnabled to set Qt.TabFocusReason and Qt.BacktabFocusReason on its delegates.

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              ratijas ivan tkachenko
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes