How do you not use the default constructor for arrays?

I want to do this:

1
2
3
QLabel *lblStation;
lblStation = new QLabel(ui->verticalLayoutWidget); //except I want this to be an array of, say, size 5.
                                                          //all using that same parent widget  

How do I accomplish that?
Well I thought I was lost, but now I think I can just use the default constructor and then use

1
2
3
lblStation[i].setParent(ui->verticalLayoutWidget); //note . instead of ->
//although now I need the & here
horizontalLayout->addWidget(&lblStation[i]);


Alternatively <vector> should work if you're okay with mixing namespaces.
Last edited on
Topic archived. No new replies allowed.