Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to add a combo box and a text box inside a tree widget?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
14 Posts 2 Posters 8.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    andre
    wrote on last edited by
    #4

    Did you look at QAbstractItemView::setIndexWidget?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      aurora
      wrote on last edited by
      #5

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aurora
        wrote on last edited by
        #6

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

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #7

          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.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aurora
            wrote on last edited by
            #8

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

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #9

              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.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                aurora
                wrote on last edited by
                #10

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

                / combobox lineedit

                  combobox    lineedit
                
                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #11

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

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    aurora
                    wrote on last edited by
                    #12

                    ok

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      aurora
                      wrote on last edited by
                      #13

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

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        aurora
                        wrote on last edited by
                        #14

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

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved