jyoti
24th November 2006, 07:48
hi all
i wanna add items in tablewidget on one buttonclick
like when i click button then item both items item n item1 shud enter at one click...
bt if i follow the following way then t first enter the item1,then item
and next is after opening i didnt get the check button....under column 0
plz do suggest me..wht to do nw
void form5::addItem()
{
int row=0;
int RowCount=0;
row=tableWidget->rowCount();
tableWidget->setRowCount(row+1);
QTableWidgetItem *item=new QTableWidgetItem("abc");
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled |Qt::ItemIsUserCheckable);
tableWidget->setItem(RowCount,0,item);
QTableWidgetItem *item1=new QTableWidgetItem("123");
tableWidget->insertRow(row);
tableWidget->setItem(RowCount,1,item1);
TIA
i wanna add items in tablewidget on one buttonclick
like when i click button then item both items item n item1 shud enter at one click...
bt if i follow the following way then t first enter the item1,then item
and next is after opening i didnt get the check button....under column 0
plz do suggest me..wht to do nw
void form5::addItem()
{
int row=0;
int RowCount=0;
row=tableWidget->rowCount();
tableWidget->setRowCount(row+1);
QTableWidgetItem *item=new QTableWidgetItem("abc");
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled |Qt::ItemIsUserCheckable);
tableWidget->setItem(RowCount,0,item);
QTableWidgetItem *item1=new QTableWidgetItem("123");
tableWidget->insertRow(row);
tableWidget->setItem(RowCount,1,item1);
TIA