How to switch items from treewidget to another treewidhet
This post is deleted!
I'm assuming that you have used QTreeWidget to create you UI.
- Write a slot for your command button
- Inside the slot, get the item selected in first treewidget. You can use the currentItem(...) API
- Inside the slots, create new QWidgetTreeItem & add this second Treewidget.
I never like duplicating model data so I'll propose a different way:
setFilterFixedString("a")on it. set the source model as
treeWidget->model()and assign it to the second QTreeView (not QTreeWidget given you are handling the model separately). Now all you need to do is call
setData(index,'a',Qt::UserRole)for each index you want to appear on the other side