January 2, 2012

aurora aurora
Lab Rat
137 posts

how to add a combo box and a text box inside a tree widget?

 

Hi, Is there any possibility of adding a text box and a combo box inside a tree widget as child of the root…
If so please tell me how can i achieve that?

13 replies

January 2, 2012

Andre Andre
Area 51 Engineer
6031 posts

Do you want them visible always, or just when the user is editing the item in question?

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

January 2, 2012

aurora aurora
Lab Rat
137 posts

they must be visible always….so that user enters info under each children of the tree widget node…

January 2, 2012

Andre Andre
Area 51 Engineer
6031 posts

Did you look at QAbstractItemView::setIndexWidget?

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

January 3, 2012

aurora aurora
Lab Rat
137 posts

ya i looked at that….So its possible right?
Ok thank u….i’ll try once, if get any prob get back to u…:)

January 3, 2012

aurora aurora
Lab Rat
137 posts

sorry Andre i didnt understand how to do that..
Would u mind to hive some more hints…
And how can i add widgets dynamically?

January 3, 2012

Andre Andre
Area 51 Engineer
6031 posts

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.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

January 3, 2012

aurora aurora
Lab Rat
137 posts

“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?

January 3, 2012

Andre Andre
Area 51 Engineer
6031 posts

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.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

January 3, 2012

aurora aurora
Lab Rat
137 posts

ok thank u Andre…
My actual need is tree structure as like this…

>
\/ combobox lineedit

combobox lineedit

>
>
>

January 3, 2012

Andre Andre
Area 51 Engineer
6031 posts

I have no idea what that ascii art is supposed to mean. Could you perhaps make a mockup image?

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

January 3, 2012

aurora aurora
Lab Rat
137 posts

ok

January 3, 2012

aurora aurora
Lab Rat
137 posts

https://picasaweb.google.com/dilip.sn/January32012#5693356856945547426

January 3, 2012

aurora aurora
Lab Rat
137 posts

i didnt understand how to upload photo here….so uploaded in picassa…plz follow here—>https://picasaweb.google.com/dilip.sn/January32012#5693356856945547426

 
  ‹‹ Style of focus frame      QScriptContext thisObject in custom include function ››

You must log in to post a reply. Not a member yet? Register here!