How to add a combo box and a text box inside a tree widget?
-
Did you look at QAbstractItemView::setIndexWidget?
-
ya i looked at that....So its possible right?
Ok thank u....i'll try once, if get any prob get back to u...:) -
sorry Andre i didnt understand how to do that..
Would u mind to hive some more hints...
And how can i add widgets dynamically? -
What do you mean by "dynamically"?
You will have to understand that setIndexWidget is not really all that model-view oriented. The widget contents are not updated with the model, and there are no automatic creation of new widgets for new items or removal of widgets for deleted items. That is not so much a problem for a static model, but there is quite a bit of coding involved to make the widgets change with a changing model.
-
"dynamically " means i'm adding widgets inside treewidget in run time(if user click on "add" button, one more child will be added to tree widget which contains one combobox and a line edit)
Is this possible Andre?
-
Of course that is possible, but it will require additional coding by you. Every time you add items, you will also need to add the corresponding widgets at the right index. It is not going to be trivial to get this right, I think. Perhaps subclassed QTreeWidgetItem's can work.
-
ok thank u Andre...
My actual need is tree structure as like this.../ combobox lineedit
combobox lineedit
-
I have no idea what that ascii art is supposed to mean. Could you perhaps make a mockup image?
-
ok
-
-
i didnt understand how to upload photo here....so uploaded in picassa...plz follow here-->https://picasaweb.google.com/dilip.sn/January32012#5693356856945547426