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.

felipe12357

Beginner

  • "felipe12357" is male
  • "felipe12357" started this thread

Posts: 8

Location: colombia

Occupation: programmer

  • Send private message

1

Thursday, August 5th 2010, 4:17pm

convert string to int and int to string

hi im beginning with Qt so im developing a simple program who recibes two dates from two lines edits and shows some answer on a Text edit, but when i tring to + this values appears me this mistake:

invalid conversion from int to QTextEdit.

can anybody tellme how can i do this convertion?? and a good link where explain qt? for me its very confuse the documentation who has Qt.

Thanks!!

yasin_motcu

Beginner

  • "yasin_motcu" is male

Posts: 32

Location: Türkiye

Occupation: Computer Engineer

  • Send private message

2

Thursday, August 5th 2010, 7:00pm

For a list of conversiion functions you must look at corresponding class references, for example, if you want to see conversion between integer to string please look at the http://doc.qt.nokia.com/4.6/qstring.html, you can find the built-in functions which will help you in static public members part.
Don´t let your fears stand in the way of your dreams!

3

Thursday, August 5th 2010, 9:57pm

int i;
QString k("%1);
k.arg(i);

4

Friday, August 6th 2010, 11:00am

The following will convert QString to int

QString num="123";
int n = num.toInt();

This will convert Int to QString

int num = 123;
QString str= QString::number(num);

Hope this will be very useful to you...