summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2014-10-16 13:38:11 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-06 20:28:40 +0000
commit35ebdeb83eb4057f5e50042747b13d0772051459 (patch)
tree98970d5f064736c9779f8b85e54a4164ae520769 /src
parent2105f801696759a365c4f928712de02e0e38e591 (diff)
QTreeView: Fix expanding of spanning items
When using HeaderView::ResizeToContents and QTreeWidgetItem::setFirstColumnSpanned(), it happens that the position of the branch icon is no longer in the first column and thus trying to expand the item results in a selection change. Check for spanning when determining the position. Task-number: QTBUG-41793 Change-Id: I14353127436fb0ebaafb0d50a31b920b8da67333 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index b339fe0f3b..b534de5c6a 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -3724,9 +3724,14 @@ void QTreeViewPrivate::updateScrollBars()
int QTreeViewPrivate::itemDecorationAt(const QPoint &pos) const
{
+ Q_Q(const QTreeView);
executePostedLayout();
- int x = pos.x();
- int column = header->logicalIndexAt(x);
+ bool spanned = false;
+ if (!spanningIndexes.isEmpty()) {
+ const QModelIndex index = q->indexAt(pos);
+ spanned = q->isFirstColumnSpanned(index.row(), index.parent());
+ }
+ const int column = spanned ? 0 : header->logicalIndexAt(pos.x());
if (!isTreePosition(column))
return -1; // no logical index at x