PDA

View Full Version : Get Visible Items from the QListWidget



srj
22nd November 2006, 17:00
Hiiiiiiiii Boyssssssssss.....


I have a QListWidget, which is having more than 10 Items, and i have placed this QListWidget as it will show 10 rows at a time, to see other items the user have to scroll the view. What i need is to retrieve the currently viewable items from the list, also need to retrieve items when a user scroll the view.


:(

wysota
22nd November 2006, 18:57
So what did you already try to achieve the goal?

srj
22nd November 2006, 20:38
Thank you for your reply

i tried to retrieve the visible item's indexs by calculation the vertical scrollbar's these values

listWidget->verticalScrollBar()->minimum();
listWidget->verticalScrollBar()->maximum();
listWidget->verticalScrollBar()->value();

with the listbox's height..... (am still hunting...:p )

is it a good idea?

how can i retrieve a row's height from the QListWidget?

wysota
22nd November 2006, 20:54
Thank you for your reply

i tried to retrieve the visible item's indexs by calculation the vertical scrollbar's these values

listWidget->verticalScrollBar()->minimum();
listWidget->verticalScrollBar()->maximum();
listWidget->verticalScrollBar()->value();

with the listbox's height..... (am still hunting...:p )

is it a good idea?

how can i retrieve a row's height from the QListWidget?

Maybe you should try with QListWidget::visualItemRect()?

Of course you might just call QAbstractItemView::indexAt() instead of hacking around, but I guess you have read the docs, so I don't have to remind you about that method...

srj
22nd November 2006, 21:13
Thanks a lot.. i believe that, i can finish it now.. after that i will publish the code on this form for reference...