Important: Please read the Qt Code of Conduct -

How to get value of a particular cell in QTableWidget on double clicking?

  • I am trying to get the value of a particular cell and store it in a variable, on double clicking a cell (itemdoubleclicked event) in QTableWidget. I know that it should be done by itemdoubleclicked event handler, but not sure how to get value of that cell. It should be something like below:


    But, this shows an error:

    AttributeError: 'PyQt5.QtCore.pyqtBoundSignal' object has no attribute 'values'

    So, values is not an attribute for itemDoubleClicked. Could you please help with the correct way to get the value of particular cell?

  • Lifetime Qt Champion

    @Piyush Check the documentation
    You get the double clicked item as signal/slot parameter:

    void QTableWidget::itemDoubleClicked(QTableWidgetItem *item)

    This does not make any sense:


    You should have your slot connected to this signal:

    def onItemDoubleClicked(self, item):

Log in to reply