0

this question的回答中,我找到了访问QTableView中所选行的第一列的方法。但是我如何访问最后一列,而不对列号进行硬编码?

        itmIndex = self.viewInQuestion.currentIndex()
        id = itmIndex.sibling(itmIndex.row(), -1)

不起作用。有什么建议么?

4

1 回答 1

0

以下方法有效:

        itmIndex = self.viewInQuestion.currentIndex()
        id = itmIndex.sibling(itmIndex.row(), self.modelForView.columnCount() - 1)
        itmCt = self.modelForView.data(id).toFloat()
于 2012-06-22T05:28:41.963 回答