Python currentrow QTableview中第一列的Pyqt5项未返回正确的值

Python currentrow QTableview中第一列的Pyqt5项未返回正确的值,python,python-3.x,python-2.7,pyqt,pyqt5,Python,Python 3.x,Python 2.7,Pyqt,Pyqt5,我有一个两列的tableview,我想获取当前选定行第一列中的项目 以下是代码片段: def shotselected(self): try: selectedRowIndex = self.tableWidget_shotselect.currentRow() print ("Selected row index: " + str(selectedRowIndex)) item = self.tableWidget_shotsel

我有一个两列的tableview,我想获取当前选定行第一列中的项目

以下是代码片段:

    def shotselected(self):
    try:
        selectedRowIndex = self.tableWidget_shotselect.currentRow()
        print ("Selected row index: " + str(selectedRowIndex))
        item = self.tableWidget_shotselect.itemAt(selectedRowIndex, 0)
        print (item.text())
    except Exception as e:
        print(e)
即使向itemAt输入手动int索引,也不会打印正确的单元格值。

itemAtx,y返回小部件坐标系中覆盖像素x,y的项目

itemrow,col返回小部件网格系统中行,col处的项目。

item=self.tableWidget\u shotselect.itemselectedRowIndex,0。