you need to add new row, and then setItem()
Qt Code:
ui->tableWidgetAll->insertRow(0);To copy to clipboard, switch view to plain text mode
also note that row and column index start from 0 (not from 1)
you need to add new row, and then setItem()
Qt Code:
ui->tableWidgetAll->insertRow(0);To copy to clipboard, switch view to plain text mode
also note that row and column index start from 0 (not from 1)
ok, thank you againi've understand than the int describes the numbers of row to add.
How i add new item?
like this?
Qt Code:
To copy to clipboard, switch view to plain text mode
Qt Code:
ui->tableWidgetAll->setItem(0,0, new QTableWidgetItem("Item Text")); //this will set the item on row 0 column 0To copy to clipboard, switch view to plain text mode
like this
Qt Code:
ui->tableWidgetAll->insertRow(0); item->setText("test"); ui->tableWidgetAll->setItem(0, 0, item);To copy to clipboard, switch view to plain text mode
add new row, but no text is shown![]()
Did you read QTableWidgetItem Documnetation, I suggest to have look at it.
Thank you for your help!
I read the documentation... but in the documentation there isn't any example.....
In some way i've done what i need.
Qt Code:
ui->tableWidgetAll->setRowHeight(0,100); ui->tableWidgetAll->insertColumn(0); ui->tableWidgetAll->insertColumn(1); ui->tableWidgetAll->insertColumn(2); ui->tableWidgetAll->insertRow(0); ui->tableWidgetAll->setItem(0, 0, item1); item2->setText("test"); ui->tableWidgetAll->setItem(0, 1, item2); item3->; ui->tableWidgetAll->setItem(0, 3, item3);To copy to clipboard, switch view to plain text mode
The last 2 questions,
1)how to create a QButton in item3?
2)how to do function if i click in item2 or item1? [like a button]
thank you again, and excuse me for all my questions
![]()
Qt Code:
connect(button, SIGNAL(clicked()), this, SLOT(MySlot())); ui->tableWidgetAll->setCellWidget(0, 2, button); // this will set the QPushButton on row 0, column 2, i.e 1st Row and 3rd Column in tableTo copy to clipboard, switch view to plain text mode
Hi All,
I want to develop this type of grid view like after clicking edit button for each row of table please refer this link
"http://www.c-sharpcorner.com/uploadfile/1e050f/edit-and-update-record-in-gridview-in-asp-net/" .....guide me for implementing same grid view using Qt and MS Sql server.....
Hi All,
I want to develop this type of grid view like after clicking edit button for each row of table please refer this link
"http://www.c-sharpcorner.com/uploadfile/1e050f/edit-and-update-record-in-gridview-in-asp-net/" .....guide me for implementing same grid view using Qt and MS Sql server.....
Bookmarks