I'm developing an application that controls a series of theatrical lights via DMX. As it stands, for testing purposes, I've placed 8 "submasters". Each submaster has a slider, to set the brightness of the light, as well as three buttons that do other functions, and a combobox that displays a numeric representation of the value.

The code to handle just these eight submasters, especially now that I'm allowing the user to adjust values and operate buttons via joystick, is growing considerably large. In the final product, I am going to need to have around thirty six of these submasters. Which means for every event where I need to get / refresh one specific slider, I end up having to write out If statements for All of the sliders.

Ideally what I would really like would be to have some way of creating (even automatically, if possible.. that way the user can specify the number of subs) these submasters, and assigning them all names independently of their qobject names. That way, instead of

lx1->setvalue(curValue[1]);
lx2->setvalue(curValue[2]);

etc, for every slider
I could just use something like

for (i < 36; i++){
submaster[i].slider->setvalue(curValue[i];
}


Any thoughts?