QTableWidget Select Row
-
Hi, I have a table which is a created with QTableWidget. I want to delete a row(with variables ofc.) when user clicks/selects that row.
How can I return a user selected row? I searched but did not get it right.@hubeytqew You can use https://doc.qt.io/qt-6/qtablewidget.html#selectedRanges, https://doc.qt.io/qt-6/qtablewidgetselectionrange.html contains the top and bottom rows.
-
@hubeytqew You can use https://doc.qt.io/qt-6/qtablewidget.html#selectedRanges, https://doc.qt.io/qt-6/qtablewidgetselectionrange.html contains the top and bottom rows.
-
@hubeytqew What is not clear? You call selectedRanges and you get QList<QTableWidgetSelectionRange>. Then you iterate over the list entries (QTableWidgetSelectionRange) and in each entry you have topRow() and bottomRow()...
-
QModelIndex index = table->selectionModel()->currentIndex(); if(table->item(index.row(), 0)) ..................