Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Round Scrolling of List Items in QListWidget
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
Rahul Das last edited by
Could you be a little more specific and clear?
Have you tried anything at all ?
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.
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...
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..
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.
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.