[PyQt] problem with QTableView.selectionChanged

Christoph Burgmer chrislb at gmx.de
Mon Oct 13 09:22:23 BST 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20081013/6e697c4a/attachment.html


More information about the PyQt mailing list