Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.1, 5.4.0
-
None
-
Windows
Description
When i drag item and drop it between 2 other items it becomes top level insted of beeing inserted where it supposed to. It happens only if VerticalScrollMode is QAbstractItemView::ScrollPerPixel and if item is dropped at red line ( on screenshot).
I think it can be fixed by editing:
int QTreeViewPrivate::itemAtCoordinate ( int coordinate) const
There is if statement:
if (verticalScrollMode == QAbstractItemView::ScrollPerPixel) { if (uniformRowHeights) { const int viewItemIndex = (coordinate + q->verticalScrollBar()->value()) / defaultItemHeight; return (viewItemIndex >= itemCount ? -1 : viewItemIndex); } // ### optimize int viewItemCoordinate = 0; const int contentsCoordinate = coordinate + q->verticalScrollBar()->value(); for (int viewItemIndex = 0; viewItemIndex < viewItems.count(); ++viewItemIndex) { viewItemCoordinate += itemHeight(viewItemIndex); if (viewItemCoordinate >= contentsCoordinate) //here return (viewItemIndex >= itemCount ? -1 : viewItemIndex); } }
And line
if (viewItemCoordinate >= contentsCoordinate)
should be like
if (viewItemCoordinate > contentsCoordinate)