Results 1 to 4 of 4

Thread: QListView multiSelection

  1. #1
    Join Date
    Sep 2006
    Posts
    42
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default QListView multiSelection

    Hi guys,

    I am using the QListView to select and to insert the data in the DataBase, however I only obtain to insert 1 item for time, would like to be able to select several items to insert everything of a time.

    I am trying to more use "multiSelection" of the "QListView" without success.

    Somebody knows if this is possible, link of form is here.

    http://200.193.29.195/qt3/list.png

    Cris.

  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: QListView multiSelection

    Can we see some code?

  3. #3
    Join Date
    Sep 2006
    Posts
    42
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QListView multiSelection

    Yes,

    Qt Code:
    1. void AvtrForm::selectViewItemVtr( QListViewItem *item )
    2. {
    3. btnInsertSalva->setEnabled(TRUE);
    4.  
    5. if (!item)
    6. {
    7. globalVtrFoo = QString::null;
    8. return;
    9.  
    10. } else {
    11.  
    12. globalVtrFoo = item->text(0);
    13. std::cout << "Test --> :" << globalVtrFoo << endl;
    14. }
    15. return;
    16. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 19th December 2006 at 23:37. Reason: missing [code] tags

  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: QListView multiSelection

    You have to iterate over all items in the view and using QListView::isSelected(const QListViewItem*) check if each of the items is selected. Then you'll get a complete list of selected items and you can process them all.

Similar Threads

  1. Replies: 0
    Last Post: 10th November 2006, 13:46
  2. How can I disable the QListView Sorting?
    By darpan in forum Qt Programming
    Replies: 3
    Last Post: 27th June 2006, 10:36
  3. Key Events for QListView
    By bmesing in forum Qt Programming
    Replies: 2
    Last Post: 4th April 2006, 09:29
  4. .gif and .tiff image type in QListView in QT3.3.5
    By darpan in forum Qt Programming
    Replies: 5
    Last Post: 18th March 2006, 04:31
  5. Keeping focus at bottom of QListView
    By jakamph in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2006, 14:45

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.