I'm creating a new instance of QTableWidgetItem
for each row the user may add, and adding it to a QVector
of QTableWidgetItems
.
I'd like to do soemthing like the following to name each instance in the following iteration with the row number included in the instance name:
QVector<QCheckBox> *checkBox_array;
for(int r=0;r<user_input;r++)
{
ui->tableWidget->insertRow(r);
*checkBox%1.arg(r) = new QCheckBox; //create an instance "checkBox1" here
checkBox_array->pushBack(checkBox%1.arg(r))
}
or something like the following, which does not compile in its current state:
for(int r=0;r<7;r++)
{
ui->tableWidget->insertRow(r);
checkBox_array->push_back();
checkBox_array[r] = new QCheckBox;
ui->tableWidget->setCellWidget(r,2,checkBox_array[r]);
}
is this possible? How can I work around this issue? All I need is to get the new widgets into the array without having to name them explicitly. Thanks in advance!
Thanks in advance.