Details
-
Suggestion
-
Resolution: Fixed
-
P3: Somewhat important
-
4.4.0, 5.12.10
-
None
-
195a35dbf (dev), eb9fd6dbd (6.8)
Description
When you drag an item and over over a closed tree item (which has children), it will expand and then collapse. A customer suggests that it remains expanded. His rationale is:
—
Expansion is what the user would expect (since the drag operation target may be inside the children of the item that is currently collapsed). Collapsing of the item, instead, isn't expected nor useful. There is no point in "closing" the view while dragging over it. Often it happens
that the user stops over an item while looking for the drop target in it's children and suddenly the parent gets collapsed: it's annoying.
The problem is at line 1183 of qtreeview.cpp:
} else if (event->timerId() == d->openTimer.timerId()) { QPoint pos = d->viewport->mapFromGlobal(QCursor::pos()); if (state() == QAbstractItemView::DraggingState && d->viewport->rect().contains(pos)) { QModelIndex index = indexAt(pos); setExpanded(index, !isExpanded(index)); <-- here } d->openTimer.stop(); }
That line should be changed into
if(!isExpanded(index)) setExpanded(index, true);
That is, the item should be expanded but never collapsed.
If you feel that collapsing might be useful for some reason I didn't find out then this behavior should be at least configurable.