Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
この質問の回答から、QTableView で選択した行の最初の列にアクセスする方法を見つけました。しかし、列番号をハードコーディングせずに最後の列にアクセスするにはどうすればよいでしょうか?
itmIndex = self.viewInQuestion.currentIndex() id = itmIndex.sibling(itmIndex.row(), -1)
動作しません。助言がありますか?
以下の方法が機能しました。
itmIndex = self.viewInQuestion.currentIndex() id = itmIndex.sibling(itmIndex.row(), self.modelForView.columnCount() - 1) itmCt = self.modelForView.data(id).toFloat()