6

I'm working with the "itemchanged" signal.
How can I find out the row and column where the item was changed? I only found the same question for c++, but I'm using python.

Yoon5oo
  • 496
  • 5
  • 11
Hubschr
  • 1,285
  • 6
  • 18
  • 35

1 Answers1

7

The slot you connect to the itemChanged() signal receives a reference to the QTableWidgetItem that changed. You should be able to call the row() and column() functions of this object to determine the row/column. For example, the code to register your slot might look like this:

self.imagesTable.itemChanged.connect(self.changeIcon)

and the function registered might look like this:

def changeIcon(self, item):
    row = item.row()
    col = item.column()
     ...
evadeflow
  • 4,704
  • 38
  • 51
  • im new to python, sry... but how exactly can i call the row() function? can you give me a little example? i have `self.model.itemChanged.connect(self.test)`what comes into the "test"-function? – Hubschr Dec 03 '13 at 21:12