Setting the value of one cell in QTableWidget fills everything.
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri Mar 28 11:19:34 EDT 2008
En Fri, 28 Mar 2008 12:01:01 -0300, Constantly Distracted
<Wayne.Oosthuizen at gmail.com> escribió:
> I've just started PyQt programming and I've run into this little
> problem. When I set the text of one cell in my table, all the other
> cells fill with that value.
> def filltable(self):
> items=QtGui.QTableWidgetItem()
Here you create a *single* object named item [why not "item" instead?]
> for column in range(self.mytable.columnCount()):
> for row in range(self.mytable.rowCount()):
> items.setText("row: " + str(row) + " column: " +
> str(column))
> self.mytable.setItem(row,column,items)
Here you set the *same* item all over the table.
--
Gabriel Genellina
More information about the Python-list
mailing list