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. Round Scrolling of List Items in QListWidget
Qt 6.11 is out! See what's new in the release blog

Round Scrolling of List Items in QListWidget

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 3.5k 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.
  • V Offline
    V Offline
    vivek.panchal
    wrote on last edited by
    #1

    hi,

    I am Using List Widget for showing six list items out of which 3 items will be displayed to user at a time. in this code no scrollbar should be shown to user. it will be hidden in this case. so when i set first item it will be shown to user in center of listwidget view area means 6th item,1st item,2nd item. and if i press right button to scroll then next case is 1st item,2nditem,3rd item ... in this manner it will go on... i have to use round scrolling in this case ... so can anyone explain how to implement this.

    thanks in advance

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rahul Das
      wrote on last edited by
      #2

      Could you be a little more specific and clear?
      Have you tried anything at all ?


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        I get the idea, but it is not supported by any of the standard Qt views. So, However, it is supported in the QML PathView Element. You could perhaps use one of these inside a QDeclarativeView on your form. Note that it should work with any QAbstractItemView as input.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vivek.panchal
          wrote on last edited by
          #4

          hey rahul ,

          i want to say i have statndard qt listwidget and i populate that with 6 items.. now user can go forward and backward in list. but selected item should always be in centre of listwidget and user can show 3 items at a time.....means if i select 4th item then in list widget i can see 3rd item,4th item,5th item ...means round scrolling in listwidget .. when i select 6th item which will be a last item in a list then order will be 5th item,6th item,1st item...

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vivek.panchal
            wrote on last edited by
            #5

            hey andre ,

            is it possible to show three list items at a time and then according to selection scroll will move back and forward to show remaining list items.... i want to show 3 items at a time with selected item in centre..

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              Like I said: there is no standard Qt view (within Qt Widgets) that does it for you. However, I don't think it will be all that hard to program. You could even use the normal item delegates to render the items. However, the positioning of the items will be up to you then.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                You might also be able to fake it (real ugly). You could create a proxy model that basically duplicates your real model many times. So instead of reporting that more model has 6 items, it would report that it has for instance 6k items. You would also need to adapt the selection model to make the selection mirror itself to the copy instances too. Of course, you would not actually copy, you would simply mirror re-use the underlying data.
                All that you need to do then, is make sure that the selected item is scrolled to the center of the view.

                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