PDA

View Full Version : clearing lineEdits



Salazaar
4th June 2007, 19:58
Hi, I've got a question. In my program I have about 200 lineEdit's. And implementation of actionNew would be
lineEdit_number->clear(); for each other. Is any method to to this by one or few lines of code?

wysota
4th June 2007, 20:02
for(int i=0;i<100;i++) lineEdit[i]->clear();

jpn
4th June 2007, 20:02
QObject::findChildren() could be abused like this:


foreach (QLineEdit* lineEdit, findChildren<QLineEdit*>())
lineEdit->clear();

;)

Salazaar
4th June 2007, 20:05
Than's, that's really useful ;)

Salazaar
4th June 2007, 21:02
But there's something wrong... Before adding this foreach loop which jpn gave mi, program was compiling in 30 seconds. After adding it, it could not compile within 15 minutes!! And it's not finished yet, I'm still waiting for the end of compilation What's wrong?