PDA

View Full Version : Retrieving Column/Row from TreeWidgetItemIterator?



JediSpam
26th September 2011, 23:52
I'm currently experimenting with QTreeWidgets and am wondering if it's possible to retrieve the column/row count from finding an item in a tree view using QTreeWidgetItemIterator? I am just simply dropping the example in the class as a slot.



QTreeWidgetItemIterator it(treeWidget);
while (*it) {
if ((*it)->text(0) == itemText)
(*it)->setSelected(true);
++it;
}
//itemText's row and column?

JediSpam
27th September 2011, 15:06
I'm sorry I didn't mean the count. I'm wanting the row/column of where "itemText" is found.

dennis81
27th September 2011, 18:07
if ((*it)->text(0) == itemText)

the column is 0 .

I think *it->parent() is more interesting in trees than the row. The row is relative to the parent.

Take a look a model view programming:

http://doc.qt.nokia.com/4.7/model-view-programming.html

http://doc.qt.nokia.com/4.7/images/modelview-models.png