You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, August 17th 2009, 2:00am

How to convert int toa string then display it?

Im new with QT and im useing qdevelop to make a simple calculator. I need to convert an int into a string so i can display it somehow on the calculator window. How can i do this and which tool should i use to display it (textbrowser?) Thanks for you help this will help me alot!

AuE

Trainee

  • "AuE" is male

Posts: 103

Location: Germany

Occupation: work

  • Send private message

2

Tuesday, August 18th 2009, 8:15am

QString myIntInString = QString::number(yourint);
where to display you have to ask youself what you may display. if a calculator is what you want I guess a lineedit will be fine!
Linux-the best text-adventure ever! :)

M_C_M

Trainee

  • "M_C_M" is male

Posts: 104

Location: GOC

Occupation: SW

  • Send private message

3

Monday, September 21st 2009, 12:46pm

there are a lot of ways. QString class itself have the functions else Refer QLocale class
#include <QLocale>
QLocale con;
int num = 1000;
QString qStr = con.toString(num);
label->setText(qStr);
an Eye 4 Qt :thumbup: