PDA

View Full Version : QTreeWidgetItemIterator howto



seneca
16th January 2006, 21:31
I want to loop through the topmost items of a QTreeWidget. I guess this would be most convenient done with the new QTreeWidgetItemIterator class introduced with 4.1.

Does anybody know where to find documentation or a sample how it works? Seems it is not yet in the Qt Assistant (at least in the 4.1 commercial) :confused:

wysota
16th January 2006, 22:33
And there is such an iterator? If it's not documented, then it's probably not for public use.

Use this:

int ind=0;
while(QTreeWidgetItem *item = treeWidget->topLevelItem(ind)){
doSomething(item);
ind++;
}

yop
16th January 2006, 22:39
It's in the 4.1 changelog (http://www.trolltech.com/developer/changes/changes-4.1.0.html). I think you should report to the tasktracker (http://www.trolltech.com/developer/tasktracker.html) as a bug.

seneca
16th January 2006, 23:17
Thanks for the loop wysota, it works for my current need.

I have asked TT to provide documentation/how-to for the new class.

seneca
17th January 2006, 09:26
Attached you find the documentation from the snapshot along with a small example that I received from trolltech support.