hi all
how can i Remove selected Rows form QTablewidget?
:confused:
Printable View
hi all
how can i Remove selected Rows form QTablewidget?
:confused:
QTableWidget::removeRow(int)...
Use the docs Luke, use the docs. :rolleyes:
I know that, but i sayed "selected rows"
Why don't you like these ?
Of course the loop and computations is left to you but I don't see the problem here... :p
Here comes a minimalistic implementation which assumes only one selection (which does not mean one colum/row/cell however...)
The complexer implementation is left as an exercise to the reader. :)Code:
void MyTableWidget::removeSelected() { QList<QTableWidgetSelectionRange> ranges = selectedRanges(); if ( ranges.isEmpty() ) return; int begin = ranges.at(0).topRow(), count = ranges.at(0).rowCount(); do { removeRow(begin); }while ( --count ); }