PDA

View Full Version : Casting variables



axisdj
6th September 2010, 16:51
Hello all,

Need some advice on the best way to cast from sting to int etc... I come from vb6 world where if I had a textbox and someone typed the value in, I could cast it from a string to a in like this cint(text1.text). I am looking for the best way to do this in QT, not only for text boxes but any input or value.Also at times would need to cast a int... to a string.

Currently I am instatiating a qstring, and calling setNum, there must be a better way.

Thanks in advance.

tbscope
6th September 2010, 17:00
QString::toInt() or toDouble() or ...
QString::number()

It's all in the documentation. Read it.