[PyQt] Re: problem with QTableView.selectionChanged

Bastian Venthur venthur at debian.org
Mon Oct 13 18:58:33 BST 2008


Thanks, that worked! I wonder why my first approach did not, since the
documentation suggests it should. Anyways, thanks for the help!


Cheers,

Bastian

Christoph Burgmer schrieb:
> Hi,
> 
> Am Monday, 13. October 2008 schrieb Bastian Venthur:
> 
>> how can I catch a selectionChanged signal from a tableView? I tried:
> 
>>
> 
>> QtCore.QObject.connect( self.tableView,
> 
>> QtCore.SIGNAL('selectionChanged(const QItemSelection&,
> 
>> const QItemSelection&)'),
> 
>> self.selection_changed)
> 
> try with a QItemSelectionModel:
> 
> fileSelectionModel = QtGui.QItemSelectionModel(itemModel, tableView)
> 
> tableView.setSelectionModel(fileSelectionModel)
> 
> self.connect(fileSelectionModel, SIGNAL(
> 
> "currentChanged(const QModelIndex &, const QModelIndex &)"),
> 
> self.cellSelected)
> 
> self.connect(fileSelectionModel, SIGNAL(
> 
> "selectionChanged(const QItemSelection &, const QItemSelection &)"),
> 
> self.updateSelection)
> 
> Hope that is what you were looking for.
> 
> Chris
> 



More information about the PyQt mailing list