Solved Move values from Qtablewidget to TextEdit
-
Hi!
I have a loop with a two-dimensional array that outputs values to Qtablewidget (a table is obtained). How do I display these values in TextEdit, for example, separated by commas? -
Hi,
In your loop concatenate the values in a string putting the comma and line returns at the right place and then set that string on your QTextEdit.
-
@SGaist said in Move values from Qtablewidget to TextEdit:
Hi,
In your loop concatenate the values in a string putting the comma and line returns at the right place and then set that string on your QTextEdit.
@SGaist Can you tell me a little more? Please
Where and how exactly do I need to convert a value to a string?int count = 1; for (int i = 0; i < ui->tableWidget->rowCount(); i++) { for (int j = 0; j < ui->tableWidget->columnCount(); j++) { QTableWidgetItem *itm = new QTableWidgetItem(tr("%1").arg((my_rand(1)))); ui->tableWidget->setItem(i, j, itm); count++;
-
You are already creating strings to put in your QTableWidgetItem, use that string and append it to a variable that you declared outside your loops.