summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2024-10-17 00:03:02 +0200
committerDavid Faure <david.faure@kdab.com>2024-10-20 04:13:13 +0200
commit195a35dbfb2453ae37d9541c82745c5795fe8b9c (patch)
tree93de36487856aa624221fa5565b887a2274a9e17 /src
parentc612a82bbaa0411ca54fbabd2ca1760f0c5e0645 (diff)
QTreeView: make autoExpand feature usable, it should never auto-collapse
The code would toggle between expanded and collapsed every time the mouse moves over the item (after the autoExpandDelay), which was unusable. As reporters point out (and I fully agree), collapsing the item under the mouse is never wanted. I attempted an auto-collapse when moving out of the current subtree, but that was not usable either: when moving the mouse down, the auto-collapsing of a previous sibling means that the item we're targeting has suddenly jumped up, it's a frustrating experience trying to aim for a moving target. The only behavior that is usable is the most simple one: auto expand, never auto collapse. Fixes: QTBUG-2553 Pick-to: 6.8 Change-Id: I2c56dd668b2df4ec23bbbe829da6e8cdd049f376 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 2dfcf2128d1..7d85442c2c4 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -310,7 +310,7 @@ void QTreeView::setHeader(QHeaderView *header)
\brief The delay time before items in a tree are opened during a drag and drop operation.
This property holds the amount of time in milliseconds that the user must wait over
- a node before that node will automatically open or close. If the time is
+ a node before that node will automatically open. If the time is
set to less then 0 then it will not be activated.
By default, this property has a value of -1, meaning that auto-expansion is disabled.
@@ -1266,7 +1266,7 @@ void QTreeView::timerEvent(QTimerEvent *event)
if (state() == QAbstractItemView::DraggingState
&& d->viewport->rect().contains(pos)) {
QModelIndex index = indexAt(pos);
- setExpanded(index, !isExpanded(index));
+ expand(index);
}
d->openTimer.stop();
}