2012-06-21 80 views
0

this question的答案中,我找到了訪問QTableView中選定行的第一列的方法。但是,如何在不對列號進行硬編碼的情況下訪問最後一列?從QTableView提取最後一列數據

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

不起作用。有什麼建議麼?

回答

0

以下方法處理:

 itmIndex = self.viewInQuestion.currentIndex() 
     id = itmIndex.sibling(itmIndex.row(), self.modelForView.columnCount() - 1) 
     itmCt = self.modelForView.data(id).toFloat() 
相關問題