QTreeView: Fix QTreeViewPrivate::itemAtCoordinate()
QTreeViewPrivate::itemAtCoordinate() did not calculate the correct item when non-uniformRowHeights is enabled and vertical scroll mode is ScrollPerPixel. This results e.g. in an activation of the item above when the click happens on the very first pixel line of an item. Another, more problematic effect was that once a drop happened on the very first line of an item, QAbstractItemViewPrivate::dropOn() calculated the root as the drop index because the visualRect of the calculated item is compared with the drop position which did not match. Task-number: QTBUG-57538 Change-Id: If89571bf0fb76fc01d60ba7139f1d985b49d70db Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
This commit is contained in:
parent
4f76c2dbad
commit
631c64582e
@ -3514,7 +3514,7 @@ int QTreeViewPrivate::itemAtCoordinate(int coordinate) const
|
||||
const int contentsCoordinate = coordinate + vbar->value();
|
||||
for (int viewItemIndex = 0; viewItemIndex < viewItems.count(); ++viewItemIndex) {
|
||||
viewItemCoordinate += itemHeight(viewItemIndex);
|
||||
if (viewItemCoordinate >= contentsCoordinate)
|
||||
if (viewItemCoordinate > contentsCoordinate)
|
||||
return (viewItemIndex >= itemCount ? -1 : viewItemIndex);
|
||||
}
|
||||
} else { // ScrollPerItem
|
||||
|
Loading…
Reference in New Issue
Block a user