not displaying old value when editing cell in a QTableWidget
<p>I have a basic QTableWidget, created with this python code:</p>

<pre><code>from silx.gui import qt
app = qt.QApplication([])
qtw = qt.QTableWidget()
qtw.show()
qtw.setColumnCount(8)
qtw.setRowCount(7)
app.exec_()
</code></pre>

<p>The <code>from silx.gui import qt</code> line is just a wrapper that finds out the installed qt wrapper (PyQt4, PyQt5 or PySide) and flattens the qt namespace.</p>

<p>The resulting table has a strange behavior when I edit a cell: as expected, the old text is highligted when I double-click the cell, but the unusual behavior is that the old text remains visible and the new text overlaps with the old one while I'm typing it, until I press enter or I click another cell.</p>

<p>I would like the old text to disappear as soon as I start typing the new one. I know it's possible, because I have an example of program that features a qTableWidget with the behavior I would like to have. </p>

<p>But I cannot find where in that program the cell editing behavior is altered. How can IÂ do this?</p>

<p>Example of "spam" and "eggs" overlayed.</p>

<p>[<img src="http://i.stack.imgur.com/Fx5tO.png" alt="example of &quot;spam&quot; and &quot;eggs&quot; overlayed[1]"></p>

<p>EDIT: the code sample without the wrapper business</p>

<pre><code>from PyQt5.Qt import QApplication, QTableWidget, qVersion
app =QApplication([])
print(qVersion())
qtw = QTableWidget()
qtw.show()
qtw.setColumnCount(8)
qtw.setRowCount(7)
app.exec_()
</code></pre>

<p>With PyQt4, use this import (also remove the <code>print(qVersion())</code> line):</p>

<pre><code>from PyQt4.QtGui import QApplication, QTableWidget
</code></pre>

<p>You could try connecting the signal emited by QTableWidget <code>cellClicked(int row, int column)</code> with a slot created for clearing the entry. <br><a href="http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slots.html#connecting-disconnecting-and-emitting-signals" rel="nofollow">http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slots.html#connecting-disconnecting-and-emitting-signals</a></p>

python qt pyqt qtablewidget