1

So guys I need some help in regards to PyQt. I'm relatively new to it and still learning. My question is about whether there is some signal that detects when an item has been selected using the arrows ? For example below this code works perfectly for calling my current_selection() method when something is clicked on by the cursor ? Thanks for reading!

self.project_table_view.clicked.connect(self.current_selection)

  • You could try to connect to either `currentItemChanged` or `itemSelectionChanged` – M4rtini Jan 22 '16 at 13:57
  • Your `QTableView` has a [selection model](http://doc.qt.io/qt-5/qabstractitemview.html#selectionModel). The selection model has a [`selectionChanged`](http://doc.qt.io/qt-5/qitemselectionmodel.html#selectionChanged) signal. – thuga Jan 22 '16 at 14:06
  • thuga I saw the selection model and selectionChanged signal mentioned elsewhere but don't see anywhere on how to implement them properly in Python ? – Paidi O Neill Jan 22 '16 at 14:21

1 Answers1

3

Thanks to thuga and this question, I got a solution using these two lines

selectionModel = self.view.selectionModel() selectionModel.selectionChanged.connect(self.selChanged)

Community
  • 1
  • 1