I'm trying to convert a string
into a short
int by using:
short tempS = QString("%1").arg(arguement);
where argument is a QString
.
however I'm getting the error:
crosses initialization of
short int tempS
There is a method toShort() in the QString class (doc):
short tempS = arguement.toShort();
As shown in the doc, two arguments can be specified: a reference to a boolean to check if the conversion succeeded, and the base if you want anything else than 10.