Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.16, 6.5, 6.6, 6.7
-
None
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:
- Just leave everything as-is and address this in Qt 7
- 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
- relates to
-
QTBUG-120768 Non-Native Dialog opens file when attempting to open invalid file
- Closed