[PyQt] setData in QTableView

Hans-Peter Jansen hpj at urpla.net
Mon Apr 11 14:43:21 BST 2011


On Monday 11 April 2011, 15:34:59 Vadym wrote:
> Hi,
>
> I try to insert some data in my QTableView via other method with
> code:
>
> self.emsTableModel.setData((self.emsTableModel.index(0, 2)),
> QtCore.QVariant(111))
>
> this code works fine and, of cource, change content of cell with row
> #1 and column#3 to 111
>
> BUT if I try do same but from other module (other file) with code:
>
> import trianon
> ...
> trianon.emsTableModel().setData((trianon.emsTableModel().index(0,
> 2)), QtCore.QVariant(111))
>
> becomes nothing... nor error, nor success

You seem to mix instance attributes and methods, which is hard to 
interpret without context. 

Why don't you simply use .model()?

> where is mistake?

Usually between keyboard and chair. 

SCR,
Pete






More information about the PyQt mailing list