Have anybody any ideas for realising custom edit key(not system F2) for editing item in qtreeview.
 Novice
					
					
						Novice
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
    
    
    
    
   
    
    
       
    
    
       
    
    
    
    
   How to activate delegated item in qtreeview by custom shotcut.
 How to activate delegated item in qtreeview by custom shotcut.
		Have anybody any ideas for realising custom edit key(not system F2) for editing item in qtreeview.
 Expert
					
					
						Expert
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
    
    
    
    
   
    
    
       
    
    
    
    
   Re: How to activate delegated item in qtreeview by custom shotcut.
 Re: How to activate delegated item in qtreeview by custom shotcut.
		Well, if you subclcass the treeview and override its keyPressEvent, the you could start editing the selected item when you press the desired key by calling QTreeView::edit(const QModelIndex&).
You can get the selected index from the selection model.
 Novice
					
					
						Novice
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
    
    
    
    
   
    
    
       
    
    
       
    
    
    
    
   Re: How to activate delegated item in qtreeview by custom shotcut.
 Re: How to activate delegated item in qtreeview by custom shotcut.
		If I have pushbutton, and want add action edit treeitem for it. Even F2 shotcut does not work:-(
 Re: How to activate delegated item in qtreeview by custom shotcut.
 Re: How to activate delegated item in qtreeview by custom shotcut.
		So connect to button's signal, pick the current item and start editing? For example:
Qt Code:
connect(button, SIGNAL(clicked()), this, SLOT(editTreeItem()));
void Window::editTreeItem()
{
if (index.isValid())
treeView->edit(index);
}To copy to clipboard, switch view to plain text mode
J-P Nurmi
visor_ua (6th December 2007)
 
    
    
       
    
    
       
    
    
       
    
    
    
    
   
    
    
       
    
    
    
       
    
    
       
    
   Re: How to activate delegated item in qtreeview by custom shotcut.
 Re: How to activate delegated item in qtreeview by custom shotcut.
		So you want to activate editing upon clicking the button or pressing the F2 key or both?
The most straightforward way is to connect the clicked() signal of the button to a custom slot in the view (or some other class), get the current index and call edit() on it. The shortcut cat be assigned to the pushbutton by using the shortcut property.
 Novice
					
					
						Novice
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
    
    
    
    
   
    
    
       
    
    
       
    
    
    
    
   Re: How to activate delegated item in qtreeview by custom shotcut.
 Re: How to activate delegated item in qtreeview by custom shotcut.
		Yes, this solution really what i need.
Thanks
Bookmarks