QTreeview with my model how to implement copy past

2019-08-08 10:25发布

I want to implement copy and paste operation in my QTreeView against my context menu copy and paste I have subclass QAbstractItemModel. I have Treeview Say Four Tope level items and each of them are having multiple child

Top Item1


----------


     Child1
           Child11
                 Child111




Top Item2


----------


Top Item3

I want to right on click item "child1" and copy child1 and all its child up to child111 and then right click and paste on "Top Item3" so that all items from child1 to child111 is copied under Top Item3.

1条回答
ゆ 、 Hurt°
2楼-- · 2019-08-08 10:45

After pressing copy you should store pointer to Child1. After pasting to Top Item Tree3 you create new child in it and copy contents of Child1 to new child. This should be done recursively.

查看更多
登录 后发表回答