I have realized that QVariant does not offer functionality for long and unsigned long. It offers conversions to int, unsigned int, long long and unsigned long long.
We can find in current Desktop architectures that long and int are equivalent, but they are not from a theoretical point of view.
If I want to store a long in a QVariant I am obligated to convert first the value to long long. I would like to know if there is any other way to overcome this.
Secondly, I am interested to know the better/simpler way to do it. I.e. using a simpler code, and avoiding the use of unnecessary space or instructions.