QAbstractItemView: disconnect from the correct delegate

Purely from a symmetry argument, we should be disconnecting the old
item delegate, not the new one.

I didn't find a case where this actually causes test failures, nor did
I take the time to implement a test where it does.

Amends a126d3627cc347500c1a6bd82027efa6d451ccbd. That patch landed in
Qt 6.7, but that branch is "closed" at this point in time, so not
picking there now.

Pick-to: 6.8
Change-Id: I06b704e699616d61c65ad676ffe45dfbd9f8a870
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e5f11eebc89ec041995cbbbc9b3db9eb3c6968c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2025-04-01 07:59:51 +02:00 committed by Qt Cherry-pick Bot
parent 76918c1f28
commit 09d266af99

View File

@ -861,7 +861,7 @@ void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate)
if (d->itemDelegate) {
if (d->delegateRefCount(d->itemDelegate) == 1)
d->disconnectDelegate(delegate);
d->disconnectDelegate(d->itemDelegate);
}
if (delegate) {