PDA

View Full Version : Conversion to QString from int or byte return wrong val...



FalloutST
1st April 2017, 18:59
textedit->insertPlainText(QString.setNum(intArray[i]));
or

textedit->insertPlainText(QString.number(intArray[i]));
same with byte array do great work but in case int = 200 i.e.
it print -56 :mad:

what is wrong with me?????????????

high_flyer
1st April 2017, 20:42
This should not even compile if it is supposed to be C++... ?!

Try:


QString strNum;
textedit->insertPlainText(strNum.setNum(intArray[i]));


But before you go further I strongly suggest you first learn the C/C++ syntax.

FalloutST
1st April 2017, 21:35
yy thank you for sugalksdjal;ksjd;lkjasdf
about setNum true, but in case I've compiled that func, i guess compiller worn about it, or not?
any way i used char array not int... my example work fine,.
Thanks for your help...

Lesiok
2nd April 2017, 11:54
any way i used char array not int... my example work fine.char is a signed type with int range <-127,127> not <0,255>.