About PySide Qt UI design: define delegates as tree items
-
Hello! I am doing a plug-in for maya. The tool I use is Qt PySide. I have trouble dealing with a custom treeview design.
What i want to achieve is making a tree like structure, each item consist of a root and some child nodes(in the same layer). Each children consist of several elements such as combobox and push button, while the root only for showing text. Each tree item represent the information and the options of a render layer, the user can adds new tree item or remove an existed one.
The concept is similar to these images:
!https://farm4.staticflickr.com/3902/14479945668_e103dcd8b9_o.png()!
!http://www.qtcn.org/bbs/attachment/Mon_1404/17_151213_257dff8c83ceef4.jpg?72()!
The problem is I am not quite sure what is the proper way to combines different qt elements into a single child node.
I hope there is a way to set tree node as a “table” like item, each item consists of different qt control elements. It’s similar to the idea below, while the cells of each column is qt controller instead of pure text.!http://qt-project.org/doc/qt-5/images/tree_2_with_algorithm.png()!
http://qt-project.org/doc/qt-5/modelview.html
Currently I define different delegates for each qt controllers (button, combobox… .etc.) . In order to set each cell as different element I use setItemDelegateForRow() and setItemDelegateForColumn(). However i haven’t find a correct way to make the tree index right.