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

QTreeView left navigation should go to parent item also on macOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.3, 6.2.3
    • Widgets: Itemviews
    • None
    • macOS
    • macOS

    Description

      If you have a QTreeView with an expanded item and one of the item's children being selected, a keyboard navigation using the left key should select the parent item.

      This works as expected on Windows and Linux. It fails on macOS. The reason is, that QTreeView::moveCursor checks for QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren , and only performs selecting the parent if this is set.

      https://github.com/qt/qtbase/blob/dev/src/widgets/itemviews/qtreeview.cpp#L2250-L2257

      But for macOS this is always false:

      https://github.com/qt/qtbase/blob/cd446a7e250671c8994ee32395fe20a59d768466/src/plugins/styles/mac/qmacstyle_mac.mm#L2882-L2884

       

      This behaviour is confusing and inconsistent:

      1. The description of "SH_ItemView_ArrowKeysNavigateIntoChildren " states "Controls whether the tree view will select the first child when it is exapanded and the right arrow key is pressed.". But it is additionally used to control the navigation to parent.
      2. The behaviour is inconsistent with the behaviour in native macOS applications. E.g. in Finder's tree view this navigation leads to the selection of the parent.

      Note that the behaviour for right navigation is indeed consistent with native tree views on macOS. A right navigation does not select the first child.

      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
            phw Philipp Wolfer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes