View Full Version : Remove Selected Rows form QTablewidget [unsolved]
hi all
how can i Remove selected Rows form QTablewidget?
:confused:
fullmetalcoder
1st April 2007, 17:31
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"
fullmetalcoder
1st April 2007, 18:09
I know that, but i sayed "selected rows"
Why don't you like these ?
QTableWidget::selectedItems()
QTableWidget::selectedRanges()
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...)
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 );
}
The complexer implementation is left as an exercise to the reader. :)
wysota
1st April 2007, 18:21
Use the docs Luke, use the docs. :rolleyes:
Hey! That's my quote! Isn't there a copyright law here or something? :cool:
fullmetalcoder
2nd April 2007, 08:57
Hey! That's my quote! Isn't there a copyright law here or something? :cool:
Sure! Apologies for having forgotten to put quotation marks...:o Maybe you can do it yourself.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.