Accessing an item in QTreeWidget
-
Hello guys,
I have a QTreeWidget, in which I inserted 3 parent items, and each parent item has a few child items, all with a single column. I succeeded in putting them in the positions I wanted them to be and they show the text they're supposed to show.
For some reason, I'm unable to access the second and third parent items. The code looks as follows:
@
filterOptions = new QTreeWidget(this);
//(add items code)
filterOptions->itemAt(0,i)->child(k)->checkState(0); // i is supposed to be the parent item number, and k the child number. But whatever i is, it returns the first parent item!!!
@Could you guys please explain how I can access some parent widget with a mere row/index number? the item from index function is protected and doesn't help.
Thank you for any efforts :-)
-
itemAt returns items at a screen position (using QPoint or x/y coordinates).
You want to use "QTreeWidget::topLevelItem() ":/doc/qt-4.8/qtreewidget.html#topLevelItem.
-
Thanks a lot :)
I wanted to post this since yesterday, but this stupid forum is so stubborn to accept some replies!!! I wish they could fix this problem because it's making me hate the forum.
-
What kind of error do you get?
Note that yesterday, the forum was moved to a new domain, and was thus in read-only mode for a couple of hours. -
thanks.........