[Qt-interest] programmatically select multiple items in a listwidget

Eric Clark eclark at ara.com
Wed Jul 15 18:34:01 CEST 2009


As far as I know, there can be only one current item at any given time in any AbstractListView. You can have multiple selections though. There are a number of ways to select the items you want. You can get the QItemSelectionModel from the widget and select each of the indexes you want by calling select() and passing in the modelindex or by calling select() and passing in a QItemSelection. Refer to http://doc.qtsoftware.com/4.5/qitemselectionmodel.html to see the different options.

Eric

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Christopher Evans
Sent: Wednesday, July 15, 2009 11:18 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] programmatically select multiple items in a listwidget

I am 'repainting' or 'refilling' a multi-select list widget, however, I 
would like the same items selected.

I have a single updateList() fn, and I am just updating the text, should 
I just make an updateListText() fn and call it a day?

I see setCurrentItem, and selectedItems.  I do not see anything like 
setCurrentItems.

Thanks,

CE

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list