If you want a qint64 you should call QString::toLongLong().
long has the problem that on Windows, or at least the Microsoft C++ compiler, a long is only 4 bytes, basically equivalent of an int.

Cheers,
_