Results 1 to 3 of 3

Thread: Buttons to add new children/siblings on QTreeView entries

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Buttons to add new children/siblings on QTreeView entries

    Hi,

    I want to build a QTreeView that displays a number of buttons on each row (such as "delete current row", "add sibling below this row", "add child below this row").
    The three possibilities for this (that I see) are
    - setIndexWiget() connected to a slot which uses the selection in the treeview to figure out where to insert/delete something
    - a custom delegate - Is there a way for a delegate to figure out on which item it was activated (i.e. get the corresponding modelindex)?
    - and of course to implement a custom view which seems like the most work.

    My Questions are:
    - Is there any important reason to pick one over the other (e.g. setIndexWiget() might not scale well for large numbers of tree items I assume. On the other hand delegates (as I currently understand them) may not actually be intended to be used to modify the model in such a way but rather only to modify data of model items)?
    - Are there other options of doing this that may be better for some reason?
    - And taking one step back: When implementing a list[-of-lists]* with such buttons on each list entry, is a QTreeView the right way to go in the first place?

    Best,
    xdn
    Last edited by xadian; 3rd September 2014 at 14:32.

Similar Threads

  1. Replies: 1
    Last Post: 27th July 2013, 00:35
  2. How to set widgets as children items on QTreeView
    By q130s in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2013, 23:40
  3. QTreeView children with multiple coulms
    By maxpower in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2012, 14:10
  4. QTreeView adding children to the view
    By Tux-Slack in forum Qt Programming
    Replies: 2
    Last Post: 20th October 2007, 09:28
  5. QTreeView and QStandardModel : add children
    By Valheru in forum Newbie
    Replies: 7
    Last Post: 19th September 2006, 17:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.