[Qt-interest] removing items from QtableWidget

algajard algajard at gmail.com
Mon Mar 16 16:56:20 CET 2009


Hey kids,

I'm new in the list. I'm using Qt-4.5 with Qt-Creator running under 
linux and I have the following problem. I have a QTableWidget with "n" 
rows. Then I select "m" rows for deletion. My problem is that the method 
only deletes "m-1" rows from the table.

QList<QTableWidgetSelectionRange> range=tipos_table->selectedRanges();

for(i=0;i<range.size();i++)
{
	top=range.at(i).topRow();
         bottom=range.at(i).bottomRow();
         for(j=top;j<=bottom;j++)
         	tipos_table->removeRow(j);
}

That is the method I wrote. The method visits all the items but the last 
item will not be deleted.

Clues, ideas ?

Regards and thanks,

-- 
"Talk is cheap. Show me the Code"
"'Regression testing'? What's that? If it compiles, it is good, if it 
boots up it is perfect."
-----------------------
Alvaro Esteban Gajardo Becerra
Estudiante Informática - Universidad del Bío Bío
Linux User #407663 counter.li.org
Chillán
Chile



More information about the Qt-interest-old mailing list