[PyQt] QTableWidget editing question

Steve Zatz slzatz at gmail.com
Fri Nov 27 15:42:02 GMT 2009

I am new to qt and pyqt but have been using wxPython for a long time.
I am converting a moderately complex application from wxPython to pyqt
and have been impressed with the ease of using pyqt.

Here's my question and I apologize for the verbiage.  The ability to
get at the default widget text editor in a QTableWidget appears pretty
limited.  You can initiate editing (editItem) but can only indirectly
try to determine if the editor is still open or has been recently
closed.  I am using the return key to initiate editing of the cells in
a particular column but the problem is when the user hits the return
key while editing an item.  Normal user interface would have that
return key close the editor but since I am trapping for the return the
app tries to open editing on the item that is already being edited and
writes "edit:  editing failed" to the console.  Now I am redirecting
both stdout and stderr but this message appears to be written by qt
directly to the console and is not going through pyqt.  So, sorry for
the longwinded note but any thoughts on either or both of the

1) can that "editing failed" message be trapped somehow and/or
2) is there any straightforward way to know that a QTableWidget item
is in the process of being edited

Note I have used the Google for these issues and although a couple
posts have touched on them, there is nothing that speaks directly to
the two questions above.  I also realize that I could probably use a
QTableView and create a custom model and delegate; however, but for
this one issue, the standard QTableWidget would work fine.

Thanks for any suggestions,


More information about the PyQt mailing list