Results 1 to 3 of 3

Thread: multiple selection of list view items

  1. #1
    Join Date
    Aug 2007
    Posts
    9
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question multiple selection of list view items

    I am using PyQt (Python 2.3 and Qt 3.3),

    I have QListView widget, I set "Extended" selection mode at time of creation. When I
    select multiple items (using Shift key), I want to get hold of those selected items
    in list view, however, could found a way to do so.

    What is the way to get all selected items in listview?

    I checked I don't have QItemSelection or QItemSelectionModel in the Qt version, I am
    using.

    regards,

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: multiple selection of list view items

    You can iterate through all the QListViewItems via QListView::firstChild() and QListViewItem::nextSibling() and see which ones are selected with QListViewItem::isSelected.

  3. The following user says thank you to marcel for this useful post:

    samirg (31st October 2007)

  4. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: multiple selection of list view items

    Or use QListViewItemIterator with "Selected" flag.
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    samirg (31st October 2007)

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.