This may be a dumb question, but I'm new to C ++ and Qt. Sorry for the inconvenience.
In Qt Designer, I create several shortcuts (for example):
my_label1
my_label2
my_label3
...
my_label n
Then, if I want to hide them, I do this:
ui->my_label1->hide();
ui->my_label2->hide();
ui->my_label3->hide();
...
ui->my_labeln->hide();
However, I would like to define tags, for example
my_label[n]
So, I could do this:
for(i=0;i<n;i++)
{
ui->my_label[n]->hide();
}
I read that I can define a widget, for example:
QLabel* my_label[5];
but is there a way to do the same with Qt Designer?
Thanks in advance!
Edit:
Finally, I decided to make a direct appointment:
QLabel* my_label_array[5];
my_label_array[0] = ui->my_label1;
my_label_array[1] = ui->my_label2;
my_label_array[2] = ui->my_label3;
my_label_array[3] = ui->my_label4;
my_label_array[4] = ui->my_label5;
Then I can do, for example:
for(idx=0;idx<6;idx++) my_label_array[idx]->show();
for(idx=0;idx<6;idx++) my_label_array[idx]->hide();
for(idx=0;idx<6;idx++) my_label_array[idx]->setEnabled(1);
for(idx=0;idx<6;idx++) my_label_array[idx]->setDisabled(1);
etc...
Then I was able to iterate. I believe this is not the cleanest way to do this, but given my basic knowledge of Qt, I'm fine.
Thanks so much for your answers! This is a great site with great people.