How to get QTableView right clicked index

后端 未结 1 1994
心在旅途
心在旅途 2021-01-23 20:49

The code below creates a single dialog with a QTableView view. On left-click the onLeftClickfunction gets an QModelIndex index. This QMod

相关标签:
1条回答
  • 2021-01-23 21:00

    You have to use the indexAt() method of the QAbstractScrollArea (QTableView):

    def onRightClick(self, qPoint):
        index = self.view.indexAt(qPoint)
        if index.isValid():
            print('onClick index.row: %s, index.col: %s' % (index.row(), index.column()))
    
    0 讨论(0)
提交回复
热议问题