hi all
how can i Remove selected Rows form QTablewidget?
hi all
how can i Remove selected Rows form QTablewidget?
Last edited by QiT; 1st April 2007 at 17:49.
power of mind > mind of power
QTableWidget::removeRow(int)...
Use the docs Luke, use the docs.
Current Qt projects : QCodeEdit, RotiDeCode
I know that, but i sayed "selected rows"
power of mind > mind of power
Why don't you like these ?
Of course the loop and computations is left to you but I don't see the problem here...
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.Qt 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 ); }To copy to clipboard, switch view to plain text mode
Last edited by fullmetalcoder; 1st April 2007 at 18:10. Reason: reformatted to look better
Current Qt projects : QCodeEdit, RotiDeCode
Bookmarks