Thanks a lot for your suggestions. I ended up doing it with the vectors because it was most elegant for my brain...

*.h

QVector<QLabel*> labels;

*.cpp

for(int i=0;i<24;i++){ labels.append(new QLabel(QString::number(23-i))); } for(int i=0;i<labels.size();i++){ labels[i].setAlignment(Qt::AlignCenter); }

and then the same for the checkboxes. I guess the vector saved about 100 lines of code.

Works like a charm :)

Bildschirmfoto_2019-10-30_13-42-22.png