PDA

View Full Version : problem: reparenting qtreewidget items in QT4



uglykid
21st November 2007, 16:33
Hi,

little problem:
i have a simple treewidgetitem struct of depth 3:

<L-01>
|---<L-11>
| |----<L-21>
|
|
<L-02>
...

As soon as i call
<L-01>->removeChild(<L-11>)

and afterwards ...

<L-02>->addChild( <L-11> )

<L-21> is no longer listed as a child of the "new" reparented <L-11> ...it seems to be lost!

Am i doing anything wrong here?

-frank

uglykid
21st November 2007, 16:52
Hi,
one addition is missing:
the Items on Level-2X have an associated widget set with:
<L-2X>->setItemWidget

as soon as i remove the setitemwidget call everything works as expected......so do i need to perform the setitemwidget call after reparenting again?

-frank

jpn
21st November 2007, 17:55
so do i need to perform the setitemwidget call after reparenting again?
Well, item widgets are not part of item hierarchy, so yes, I'm afraid you will have to relocate them yourself when item hierarchy changes.