PDA

View Full Version : problem with tablewidget..



reshma
22nd March 2009, 16:22
hello,

my problem is that i need to remove all the rows of the table and then add new rows..
al these work at runtime only..

so i wrote the following code...
but cant understand where the problem is..

row=table->rowCount();
for(int i=0;i<=row;i++)
table->removeRow(i);
row=0;
queryForMem();//this takes input for the new row..

one row always remains and doesnt get removed..
new instructions do not work on this table any more...

like i cannot add a new row through some other functions..

plz help me out...

spirit
22nd March 2009, 16:28
why do not simply call QTableWidget::clear?
PS. please, use tags CODE .

Lykurg
22nd March 2009, 16:29
Damn, you are very resistant to advices! USE THE FUCKING CODE TAGS! The last time I'll help you when you are not going to use them:
QTableWidget::clearContents(), and then reset the dimension.

Lykurg
22nd March 2009, 16:30
@spirit: Why are you always some seconds earlier :confused:

spirit
22nd March 2009, 16:30
@spirit: Why are you always some seconds earlier :confused:

I don't know :D;)

reshma
22nd March 2009, 16:34
do u mean like dis...


row=table->rowCount();
for(int i=0;i<=row;i++)
table->removeRow(i);
row=0;
queryForMem();//this takes input for the new row..


ok.. but clear() doent remove the rows totally...it just removes the contents..

spirit
22nd March 2009, 16:37
do u mean like dis...


row=table->rowCount();
for(int i=0;i<=row;i++)
table->removeRow(i);
row=0;
queryForMem();//this takes input for the new row..



yes



ok.. but clear() doent remove the rows totally...it just removes the contents..
set row count to "0" after clear.