Unsolved QAbstractItemView::ScrollMode
-
Hello!
As I see that, scrollMode supports two types -
QAbstractItemView::ScrollPerItem 0 The view will scroll the contents one item at a time. QAbstractItemView::ScrollPerPixel 1 The view will scroll the contents one pixel at a time.
What I need is, "ScrollPerPage". How do I achieve this?
Thanks,
Kumara -
@kumararajas
i think this is pretty tricky.
You need to prevent that mouse-events (and also some key events) are received by the scroll-bar. Especially the scrolling by mouse is tricky. Since you want it to feel "correct". When moving the mouse (while holding the scrollbar) you want to do the scrolling only when the scrollbar has passed the value of the next page's index.
For scrolling by keys you can easily use scrollTo() to the index on the next page.So a lot of work to make it feel right for the user.
-
@raven-worx Thanks for the response.
I completely understand that, it is going to be tough to implement in all the possible ways, to make the better experience for Scrolling per page.
But in short, I could achieve this (and also understood the idea behind) that, by default Qt provides scroll per item and scroll per pixel.
If we need to go for customized scroll, example - on down arrow key press, scroll to 10 items, then we can make use of
scrollTo
This is pretty cool for such customizations..
I used this and implemented my own way of scrolling steps.
However, I understand from your response that, I would be missing some cases to handle. But, it should be based on application need.
Thanks,
Kumara -
@kumararajas
maybe this idea is suitable also for you