phil_
20th January 2006, 19:14
Hi,
I'm rather new to C++ and now I need a dynamic amount (int i) of buttons. I tried something (where I was sure that it wouldn't work, but just to tell you what I need) like this:
int i; i=0;
for(;i<9;i++){
QLabel label(&fenster);
label.setFrameStyle(QFrame::Panel | QFrame::Sunken);
label.setText("first line\nsecond line");
label.setAlignment(Qt::AlignTop | Qt::AlignLeft);
label.setGeometry(10*i,80,120,50);
}
I know that normally it would be my job to learn C++ properly, but perhaps you could be so kind and correct the code given above.
Thanks.
I'm rather new to C++ and now I need a dynamic amount (int i) of buttons. I tried something (where I was sure that it wouldn't work, but just to tell you what I need) like this:
int i; i=0;
for(;i<9;i++){
QLabel label(&fenster);
label.setFrameStyle(QFrame::Panel | QFrame::Sunken);
label.setText("first line\nsecond line");
label.setAlignment(Qt::AlignTop | Qt::AlignLeft);
label.setGeometry(10*i,80,120,50);
}
I know that normally it would be my job to learn C++ properly, but perhaps you could be so kind and correct the code given above.
Thanks.