I have a QListView that displays square-shaped items. My problem is that when I scroll this list, it scrolls one entire row of squares at a time, and I think that doesn't look right. Instead, I would like the list to scroll 1 pixels or two at a time - i.e. smoothly. It's mostly a cosmetic change. Any idea how I would do that?
Smooth scrolling in a QListView (or QAbstractItemView)
Ok I just found there's a property for that:
listView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
The other option, the default, is ScrollPerItem.
Tried your solution and it didn't work for me. But it worked well when i added:
listView -> verticalScrollBar() -> setSingleStep(5);
Or something like that, sorry for mistakes if there are any, i'm writing in PyQt5:
listView.verticalScrollBar().setSingleStep(5)
Edit: oh, i haven't noticed the year of this answer...
Thanks for your late answer, scroll per pixel didn't work for me. I had to set the single steps as you did! –
Holmgren
© 2022 - 2025 — McMap. All rights reserved.