
Originally Posted by
QiT
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... 
Here comes a minimalistic implementation which assumes only one selection (which does not mean one colum/row/cell however...)
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 );
}
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
The complexer implementation is left as an exercise to the reader.
Bookmarks