Results 1 to 5 of 5

Thread: Get Visible Items from the QListWidget

  1. #1
    Join Date
    Nov 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Get Visible Items from the QListWidget

    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.



  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Get Visible Items from the QListWidget

    So what did you already try to achieve the goal?

  3. #3
    Join Date
    Nov 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get Visible Items from the QListWidget

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

    is it a good idea?

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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Get Visible Items from the QListWidget

    Quote Originally Posted by srj View Post
    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... )

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

  5. #5
    Join Date
    Nov 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get Visible Items from the QListWidget

    Thanks a lot.. i believe that, i can finish it now.. after that i will publish the code on this form for reference...

Similar Threads

  1. Qt 4.2: QListWidget changes size of its items
    By KingFish in forum Qt Programming
    Replies: 2
    Last Post: 25th October 2006, 12:06
  2. Replies: 3
    Last Post: 10th April 2006, 20:04
  3. [Qt4]: Adding centered items in QListWidget
    By Jojo in forum Qt Programming
    Replies: 4
    Last Post: 16th March 2006, 21:04
  4. Getting all items of a QListWidget
    By Codepoet in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2006, 23:52
  5. How do I find out which widgets/canvas items are visible?
    By Tommytrojan in forum Qt Programming
    Replies: 11
    Last Post: 6th January 2006, 14:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.