Sunday, March 28, 2010

QString <-> number conversion

Today i had a small problem with converting a QString to integer.
i found the solution and i wanted to share it :
QString str;
int x =10;
str = QString::number( x ); // str will be a string whose text = "10"
what about coverting a QString to integer number?
here we can use the .toInt() function:

QString str = "50";
int x;
x = str.toInt(); // x = 50
This page helped me alot 


i recommend this book for Qt users.

Thanks for reading,
Bassem Elhaouary

0 comments: