Qt World Summit: Register Today!


QTableWidget, how to check if a certain row is selected or not?



  • Hi,

    In my code, I used selectRow(int) to select rows. Now, I need to know if a certain row is selected. Is there such a function in Qt? Thanks in advance.


  • Moderators

    Not directly, but you can call selectedItems() or selectedIndexes() method and check if the row you're looking for is on the list.
    Other method would be to take a first item in that row and check if isSelected() returns true.


Log in to reply