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




 
					
					 
							
						 Buttons to add new children/siblings on QTreeView entries
 Buttons to add new children/siblings on QTreeView entries
		 
				
				
				
					 Reply With Quote
  Reply With Quote 
							
								
 
    
    
       
    
    
       
    
    
       
    
    
    
    
  
Bookmarks