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
Printable View
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
just use QString("....%1....").arg(x); while this will probably use the int overload, this will work.
This will result in:Code:
signed short int shi = 10; unsigned short int usi = 11; signed long int sli = 12; unsigned long int uli = 13;
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().