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