[PyQt] Browsing QTableWidget items

paulino1 at sapo.pt paulino1 at sapo.pt
Fri Aug 24 18:32:24 BST 2007


Hi!

I would like that the Enter/Return key pressed have the same behaviour  
as the TAB key in a QTableWidget, so that for the user it is equal to  
press "ENTER" or "TAB". How can i do that?


I have a dialog with 2 QTableWidgets in a master / detail relation. I  
want the focus to switch from the master to the details when the last  
column inthe master was edited.

I set a connection form the master's cellChnaged SIGNAL to a function  
that verifies in wich column the signal was emited and if it is the  
last one it executes the following code:

             self.tabMaster.clearFocus()
             self.tabDetails.setFocus()
             self.tabDetails.setCurrentCell(0,0)
             item = QTableWidgetItem()
             self.tabDetails.setItem( 0 , 0, item )
             self.tabDetails.editItem( item )

It works on a Enter key press. Uf I press the TAB key instead of  
switching the focus to tabDetails the focus goes to the first column  
of a new line.


Thank you far any help!

Paulino



More information about the PyQt mailing list