0

I want to keep the latest child nodes always to in the top level items in qtreewidget, how is this possible ?

Normally QTreeWidgetItem::addChild() append the child item, so I tried QTreeWidgetItem::insertChild(0, childItem) but this doesnt helped me.

I am using Qt 4.8.4 (MSVC 2010, 32 bit), in Win 7.

Prady
  • 663
  • 3
  • 11
  • 28

1 Answers1

0

You can read in documentation of QTreeWidgetItem::insertChild that if a child item is already inserted in your tree widget, insert it again will not produce any effect.

Then a workaround would be to use QTreeWidget::removeChild before, and after that insert it at the first place.

epsilon
  • 2,849
  • 16
  • 23