Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAbstractItemView::ScrollMode
Qt 6.11 is out! See what's new in the release blog

QAbstractItemView::ScrollMode

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kumararajas
    wrote on last edited by
    #1

    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

    --Kumar

    raven-worxR 1 Reply Last reply
    0
    • K kumararajas

      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

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @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.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      K 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @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.

        K Offline
        K Offline
        kumararajas
        wrote on last edited by
        #3

        @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

        --Kumar

        raven-worxR 1 Reply Last reply
        0
        • K kumararajas

          @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

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @kumararajas
          maybe this idea is suitable also for you

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved