PDA

View Full Version : Getting all items of a QListWidget



Codepoet
17th January 2006, 23:36
Hi!

I'm currently using the following code to get all items in a QListWidget:

QList<QListWidgetItem*> items = list->findItems(QString("*"), Qt::MatchWrap | Qt::MatchWildcard);
Is there a better / faster way? I just can't find a allItems() call.

Codepoet

yop
17th January 2006, 23:40
What would allItems() return?
There is a count() member so you can loop through the QListWidget items and add them to your container.

Codepoet
17th January 2006, 23:48
allItems would return a QList<QListWidgetItem*> containing every QListWidgetItem which is at the moment in my QListWidget without forcing me to do hundreds / thousands of calls to item(). Just something like selectedItems.

But I'll try your suggestion ;)

yop
17th January 2006, 23:52
... forcing me to do hundreds / thousands of calls to item()...My suggestion will also do that I'm afraid :(