1

I'm trying to make some kind of recursion. If you open P then you can open P again or do something else. And here is my problem:
I can't add same item twice.

while (*it) {
    if ((*it)->text(0) == item->text(0)){
        (*it)->setText(0,"Add_item");
        (*it)->addChild(item);
    }
}

Can I make a loop in QTree ?

dev-masih
  • 4,188
  • 3
  • 33
  • 55

1 Answers1

0

You need to create another item. It seems you add for the same text the same item object over and over again as child. So making a copy of the item and adding that copy as child should work.

Aaron
  • 1,181
  • 7
  • 15