Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.12, 5.15.7, 6.2.2
-
None
Description
I have (these points are not nececssary to reproduce the bug, just to provide context):
- I have two QTreeViews inside a QSplitter
- Both tree views use the same model
- Tree views are synchronized with each other with connect(left, &QTreeView::expanded, right, &QTreeView::expand); etc
Then (this is necessary)
- The model is QSortFilterProxyModel
- Source model has N columns
- The first QTreeView displays the first M columns
- The second QTreeView displays the last (N-M) columns (column 0 is hidden too - this is important)
- Both QTreeViews have drag&drop enabled
The bug:
- Drag doesn't work for child indexes in the right QTreeView (works only for top-level indexes, i.e. the ones whose parent() is invalid)
- This happens because QAbstractItemViewPrivate::selectedDraggableIndexes ignores the child indexes. This in turn is because QTreeView::selectedIndexes() removes indexes whose parent is hidden.
while (index.isValid() && !isIndexHidden(index)) index = index.parent();
- QSortFilterProxyModel::parent() always returns an index with column() == 0, so if the column 0 is hidden, QTreeView::selectedIndexes always treats child indexes as hidden.
- However, the child index is visible (i.e. the user can see it on the screen) and is selectable so this behaviour is incorrect.
Attachments
Issue Links
- relates to
-
QTBUG-74579 QTreeView::selectedIndexes() returns empty list if column 0 is hidden
- Reported
Gerrit Reviews
For Gerrit Dashboard: QTBUG-99419 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
388150,2 | QTreeView: Avoid discarding children rows if parent column is hidden | dev | qt/qtbase | Status: NEW | -1 | 0 |