Please nominate your Qt Champions for 2021!

[SOLVED] Retrieving an entire row of data from a QTableWidget

  • Hi, and help, I cannot seem to wrap my head around this, I have a popup window that has a QTableWidget named messageBox with 6 columns in it which I have the flags set to select the whole row upon clicking on it with


    Then I have connected the double click signal to it with

    connect(messageBox, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(commentBoxItemClicked(QTableWidgetItem*)));

    It works fine, the signal fires when expected to but the *item only contains the column that was clicked, what needs to be done to pass the whole row to the slot instead of just the particular cell that was clicked.

    Thanks in advance.

  • Lifetime Qt Champion


    The item provides both information with the row and column information. To get the other items the you just have to iterate over all the columns in the given row. Or use the selectedItems() function

  • Hi, and thanks for pointing me in the right direction.

Log in to reply