check whether a row is filled with values in tablewidget and fill values in new row
hi i am trying to get the inputs from 4 line edit widgets and paste it into table-widgets & also able to fill the first row in table .
can any one help me out how to check whether the first row is filled and if it is filled how to add the data s in the next consecutive rows one by one in table widget
Any one can suggest me some solutions.
Thanks in advance
Code:
void Widget::on_pushButton_Add_clicked()
{
ui
->tableWidget
->setItem
(0,
0,
new QTableWidgetItem(ui
->lineEdit_UDPport
->text
()));
ui
->tableWidget
->setItem
(0,
1,
new QTableWidgetItem(ui
->lineEdit_DataName
->text
()));
ui
->tableWidget
->setItem
(0,
2,
new QTableWidgetItem(ui
->lineEdit_DataAddress
->text
()));
ui
->tableWidget
->setItem
(0,
3,
new QTableWidgetItem(ui
->comboBox_DataType
->currentText
()));
ui
->tableWidget
->setItem
(0,
4,
new QTableWidgetItem(ui
->lineEdit_DataLength
->text
()));
}
Re: check whether a row is filled with values in tablewidget and fill values in new r
Do you start with an empty table or with a table with one empty row?
Cheers,
_
Re: check whether a row is filled with values in tablewidget and fill values in new r
Thanks for your reply . by default i have fixed the size for the table with 10 Rows and 5 columns in the UI
Re: check whether a row is filled with values in tablewidget and fill values in new r
Then you need to keep track which row is the next empty one and then use this to call setItem().
if the next row is == rowCount() then add a new row
Cheers,
_
Re: check whether a row is filled with values in tablewidget and fill values in new r
hi thanks, the code which i have pasted in the first thread will copy the contents from different line edits(inputs) after clicking the push button it copies and paste it in the first row of the table widget.
and when i try to give the input in different line edit boxes once again it must be pasted in the second row of the table widget. it is not happening. please do help me out
the size of the table widget is fixed in the UI form as 10 rows and 5 columns
Re: check whether a row is filled with values in tablewidget and fill values in new r
Well, your current code specifies row 0, you obviously need to make that a variable that you increase when you've added a row.
Cheers,
_