Cycle where i append variables to the end of widget names

21 views Asked by At

For my app im creating i need to display values in three separate table widgets. I have currently three tables named like this:

    //tableWidget_line_1
    //tableWidget_line_2
    //tableWidget_line_3

I would like to create a for cycle that would assign numbers of rows like this, and later perform other operations with them.

Idea i've tried was:

for(int k=0;k<3;k++){
ui->tableWidget_line_[k]->setRowCount(k);
}

so the first tablewidget would have one line, second two, third three...

Tried this naming technique

ui->tableWidget_line_'"+[k]"'->setRowCount(k);
and
ui->tableWidget_line_"+[k]"->setRowCount(k);

but to no avail.

Any assistance would be greatly appreciated since. I realise this might not be solvable since i havent yet ran into anyone having this issue, but maybe someone will know.

Thanks!

0

There are 0 answers