I have a binary vector (it is in hex)
For Example -
x={0x06, 0xfc, 0x47}
I want to save it in a QStringList
and then read it from the list and display all of them in one element of QTableWidget
. How can I do this? I did this previously with a for loop but it only displays the last vector element (0x47)
in the table.
Thanks.
You can do it like this:
QStringList list;
for(int i = 0; i < vector.size(); ++i)
{
list.append(QString::number(vector[i], 16));
}
// i - row, j - column in function join put your separator(for example "\n" if you want all items in new row)
ui->tableWidget->setItem(i,j, new QTableWidgetItem(list.join("\n"));