PDA

View Full Version : how to sync a QTreeWidget and a QListWidget?



zl2k
3rd September 2008, 22:10
hi, there

I have a qtreewidget and a qlistwidget in a form. The qtreewidget accepts drop operation. Once a item dropped on a node, I need to record the item's info and the node info on the qlistwidget. The qtreewidgetitem won't be changed on drop operation (let's just count the times of each node being dropped).

What I need to know is: how can the qlistwidget know if something is dropped in the qtreewidget? I know how to implement the drop operation in the qtreewidget but don't know how to pass that info to qlistwidget.

I basically follow the tutorial here http://sector.ynet.sk/qt4-tutorial/dnd.html.
The qtreewidget promote to myqtreewidget class where the drop operation is implemented.

Thanks for your comments.

zl2k

jacek
4th September 2008, 00:52
I know how to implement the drop operation in the qtreewidget but don't know how to pass that info to qlistwidget.
You can make tree widget emit a signal and connect it to a slot in list widget. Of course that means you have to subclass both widgets.

zl2k
5th September 2008, 20:55
Thanks, I got it.