Hello
thnaks for your responses
this is my code :
here , a QPushButton to run the action :
void AcheterMed::on_suppMed_clicked()
{
pieces->removeRow(pieces->currentIndex().row());
}
void AcheterMed::on_suppMed_clicked()
{
pieces->removeRow(pieces->currentIndex().row());
}
To copy to clipboard, switch view to plain text mode
pieces is my QTableWidget , i add items in with this code :
void AcheterMed::on_valider_clicked()
{
item1->setText(numero->text());
item2->setText(libelle->text());
item1->setFlags(Qt::ItemIsEditable);
item2->setFlags(Qt::ItemIsEditable);
int j = pieces->rowCount();
for(int i=0;i<nbrePieces->text().toInt();i++)
{
pieces->insertRow(j + i);
pieces->setItem(j + i,0,item1);
pieces->setItem(j + i,1,item2);
}
}
void AcheterMed::on_valider_clicked()
{
QTableWidgetItem *item1 = new QTableWidgetItem;
QTableWidgetItem *item2 = new QTableWidgetItem;
item1->setText(numero->text());
item2->setText(libelle->text());
item1->setFlags(Qt::ItemIsEditable);
item2->setFlags(Qt::ItemIsEditable);
int j = pieces->rowCount();
for(int i=0;i<nbrePieces->text().toInt();i++)
{
pieces->insertRow(j + i);
pieces->setItem(j + i,0,item1);
pieces->setItem(j + i,1,item2);
}
}
To copy to clipboard, switch view to plain text mode
and i have no others slots !
i still have the same problem 
n.b : i want to remove the row selected from pieces , pieces is set to singleselections + selectrows .
this is all !
thanks again 
i had also the same problem with clearContents() of my QTableWidget , but i use setRowCount(0) , and it's working
Bookmarks