removing of selected rows
Hello everyone ........
I have a problem that I wana remove selected row from Q3Table but whenever i remove it , there remains one selected row.............
I don't know what mistake I m doing ????
My code is as following ......
Code:
void dlgCreateplaylist::pbRemove_clicked()
{
int flag=0;
numberFrame1=0,numberFrame2=0,numberFrame3=0;
pbSelectall2->setText("Select All");
int checked[25],index=0;
/******************************************************
*check the row number in table2 is checked or unhecked and remove*********
******************************************************/
Q3CheckTableItem *pb1 = new Q3CheckTableItem(Table2, " ");
for(int r=0;r<Table2->numRows();r++)
{
pb1=(Q3CheckTableItem *) Table2->item(r,0);
if(pb1->isChecked())
{
checked[index++]=r;
Table2->removeRow(r);
qDebug()<<"value of Index"<<index;
r=r-1;
flag=1;
flags=0;
}
}
if(flag==0)
{
QMessageBox::information( this,
"Createplaylist",
"Select the Media item to Deleted.");
}
Please if anyone can do something I'll apperciate his reply........Thanx in advance:confused:
Re: removing of selected rows
It seems that you are creating a new item (which is never used).
Re: removing of selected rows
As jpn mentions, you add a row to the table whenever pbRemove_clicked() is called.
this happend at line 23 in the shown code
you could avoid this by replacing that line with:
Code:
Q3CheckTableItem *pb1 = 0;
Re: removing of selected rows
Thanx for reply but tht is not solution ...............I just want to remove selected rows nothing else..........
for this I use Q3checkTableItem to only tht perticuler row is Checked or not.........but What mistake I m doing tht there remains one row...............
If you can do something please I really need ur help:(
Re: removing of selected rows
Actually it IS the solution.
Quote:
Originally Posted by
MrShahi
Code:
Q3CheckTableItem *pb1 = new Q3CheckTableItem(Table2, " ");
This will create a NEW item and add it to Table2. According to your problem description this is exactly what you want to avoid.