Did you even bother to take a look at QAbstractItemView::scrollTo() docs? The hint mentioned is one of its arguments...
I have read everything possible, I just don't get how to realize the child class based on QAbstractItemView. Can you tell me what is the minimal set of obligatory methods for realizing my own ListView? Is it enough to create own class based on QListView and to re-denote only scrollTo method in it? How to accomplish it better?
But why create an own view? You have to use the scrollTo() method, not reimplement it.
Thanks, I managed to do scrollTo. But it came out not quite the way I wanted.
For example we have the list:
item_1
item_2
item_3
item_4
item_5
item_6
item_7
item_8
only 5 items fit into QListView list in my app, so after launch my ListView should look like this:
---------------------------
| item_7 |
| item_8 |
|--------------------------|
| item_1 |
|--------------------------|
| item_2 |
| item_3 |
---------------------------|
So the list must croll around and the central item should stay in the middle unmovable. How do I do it?
May be
void QListView::indexesMoved ( const QModelIndexList & indexes ) [signal]
void QListView::setPositionForIndex ( const QPoint & position, const QModelIndex & index ) [protected]
Or is there any other way? Please help.
Where should I add the additional items? Into the model? How do I do that?The easiest way is to add additional items.
and what routines exactly I need to reimplement in the created class, based on QListView?The proper way is probably to subclass the view and reimplement the painting and positioning routines.
Bookmarks