Make QTreeWidgetItem unique among siblings

僤鯓⒐⒋嵵緔 提交于 2019-12-10 17:56:15

问题


Is there some way to make sure that updating an existing QTreeWidgetItem or inserting a new one ensures that the item is unique among its siblings based on the value of a single column?

I have tried to do something like this with a QTreeView and my own custom model and have gotten it to work, but some advanced features like moving items with drag and drop are eluding me. I figure, the QTreeWidget and QTreeWidgetItem classes ought to get more of this type of stuff for free and ought to cause me fewer headaches throughout. However, I still need to be able to guarantee uniqueness if I go the QTreeWidget route. Can this be done? If so, how?

NOTE:

I am using PySide, but I marked this question as PyQt as well since most solutions cross over between the two without much fuss.

来源:https://stackoverflow.com/questions/34802936/make-qtreewidgetitem-unique-among-siblings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!