Hi everyone,

I have a question about the for() loop function in Qt.
in my program, i have 10 labels, which indicate 10 led lights.
I can change the color for each label by using:
Qt Code:
  1. ui->label_led_1->setPixmap(picLedRed);
  2. ui->label_led_2->setPixmap(picLedRed);
  3. ...
To copy to clipboard, switch view to plain text mode 

I wonder how can i use the For() loop to simplify the code.
ex:
Qt Code:
  1. for (int i = 1; i <=10; i ++)
  2. ui->label_led_i->setPixmap(picLedRed);
To copy to clipboard, switch view to plain text mode 

Can any one tell me how i can increment the label number i, please?

Thanks in advance.