Scrolling through the QListView items !
Stoned Jesus last edited by
I have a QListView which has a horizontal scroll bar. When I drag and drop an item, the scroll bar should move to the appropriate position as per the cursor position.
But when the mouse cursor is at the end of the viewport of the qlistview, scrolling stops. The problem is scroll bar doesnt get the "x" position at the end of the qlistview's viewport.
raven-worx Moderators last edited by
This is not trivial, since you cannot get mouse events if the drag for instance leaves the application window boundaries...
the only possibility to overcome this problem would be to subclass qlistview, override "QAbstractItemView::startDrag()":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#startDrag and do the same like QListView does in there.
Once the drag starts you need to poll the cursor position with a timer and adapt the scrolling.
But this solution also only works for drags started in the list itself (no external drags).