基本的に、最初の関数では、マウスを使用して選択したセルを取得し、data()メソッドを使用してそのセルからデータを取得し、最初の関数で表示することができます。
ただし、セルを選択すると、その行の最初のセル(最初の列)のデータが表示されるように少し変更したいと思います。選択したセルのindex(currentCell)がすでにあるので、新しいModelIndexオブジェクトをインスタンス化して、選択したインデックスをそれに割り当てます。次に、オブジェクトの列を0に変更します。最後に、data()mtohodを使用して新しいオブジェクトでデータを取得したいのですが、何もありませんでした。nullです。多くの時間を費やしていて、何であるかわかりません。問題。助けて読むためにいくつかの努力を提供してくれた人に感謝します:)
def tbRobotChanged(self, currentCell):
# get the selected cell's index from currentCell,Implement the Slot method
self.statusBar().showMessage("Slected Robot is "+
currentCell.data().toString())
def tbRobotChangedt(self,currentCell):
crow_header_Index = QtCore.QModelIndex()
crow_header_Index = currentCell
crow_header_Index.column = 0
self.statusBar().showMessage("Slected Robot:"+crow_header_Index.data().toString())