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

QTreeView item double-click erroneously emits activated on indexes without Qt::ItemIsEnabled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.16, 6.5, 6.6, 6.7
    • Widgets: Itemviews
    • None
    • All

    Description

      Consider a QTreeView with some items in it. The index of one of these items does not have the Qt::ItemIsEnabled flag. If you double-click that item, the QTreeView's activated signal gets fired.

      I believe this is erroneous, given how the behavior of other disabled items work in Qt. The documentation for QTreeView, nor QAbstractItemView dictate what happens if an item does or does not have the flag Qt::ItemIsEnabled, so, technically the implementation is fine, but IMHO, it goes against the behavior of widgets' enabled flags. I think the general user expectation would be that disabled indices in a list cannot be activated.

      Attached qtreeview-activate-inactive-bug.7z reproduces the issue.

      Possible solutions

      Now, given that this behavior has been in Qt for a long time now, I can believe that there is software out there that may be expecting this behavior now, so I don't think this is something we can change the default behavior of.

      There are several solutions I can think of:

      1. Just leave everything as-is and address this in Qt 7
      2. Add a boolean setter to QTreeView to activate the new "correct" behavior of not emitting activated on double-click events for QModelIndexes that do not have the Qt::ItemIsEnabled flag.

      Attachments

        Issue Links

          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
              kkyzivat Keith Kyzivat
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes