PDA

View Full Version : Converting to integer



Salazaar
15th June 2007, 20:59
Hi. I've got a question. I want to convert QString to int, to bo able to make some calculations. Is it correct:

QString string = lineEdit->text();
string.toInt();
In docs it isn't clearly explained. And if it's correctly, can to refer to this converted value?

daracne
15th June 2007, 21:07
That is the correct way to do it. However, you need to store the int value from the conversion function. To do this you would modify your code to be...



QString string = lineEdit->text();
int myInt = string.toInt();

Salazaar
15th June 2007, 21:11
Thanks ;) Regards