Hai
How to create control array like other programming languages.
and how to convert integer to string?..
Code:
int i=8; lineEdit->setText(tr("%1").arg(i)); // its working is there any other way..
Printable View
Hai
How to create control array like other programming languages.
and how to convert integer to string?..
Code:
int i=8; lineEdit->setText(tr("%1").arg(i)); // its working is there any other way..
What do you mean with "control array like other programming languages"?
Best Regards
NoRulez
Thanks
Control Array means group of controls with same name.
Eg.
I want 10 lineEdit in same name [lineEdit] with index
How to do this in QT4?Code:
lineEdit[0]->setText("suresh"); lineEdit[1]->setText("suresh"); lineEdit[2]->setText("suresh"); . . . lineEdit[9]->setText("suresh");
Something like this :
Code:
It's better to use an iterator like the following
or an foreach loop:Code:
QList<QLineEdit*> lineEdits; for(QList<QLineEdit*>::iterator iter = lineEdits.begin(); iter != lineEdits.end(); ++iter) { (*iter)->setText("Some Text"); // In Qt i think you can also use the following // iter->setText("Some Text"); }
Best Regards
NoRulez