Row and column from “Itemchanged” signal

你说的曾经没有我的故事 提交于 2021-01-27 06:53:41

问题


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.


回答1:


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()
     ...


来源:https://stackoverflow.com/questions/20359834/row-and-column-from-itemchanged-signal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!