Is there an equivalent to sprintf( str, "%hd", intToShort) for QString::arg? I noticed in the docs that QString::sprintf does not support the %h flag, but is there a way to write the short?
Thanks
Is there an equivalent to sprintf( str, "%hd", intToShort) for QString::arg? I noticed in the docs that QString::sprintf does not support the %h flag, but is there a way to write the short?
Thanks
Every little child knows
if you cant see dreams
your eyes are blind
Moxy Fruvous
just use QString("....%1....").arg(x); while this will probably use the int overload, this will work.
This will result in:Qt Code:
signed short int shi = 10; unsigned short int usi = 11; signed long int sli = 12; unsigned long int uli = 13; To copy to clipboard, switch view to plain text mode
10 - 11 - 12 - 13 - Hello World
Just as easy as that. If you need to make sure data is short and not long, double or other, you should typecast or convert instead of relying on %h from sprintf.
... or use additional parameters to QString::arg().
Bookmarks