Search code examples
qt64-bitint64qvariantqsettings

Saving 64-bit integer with QSettings


Is there any neat way, short of converting number to QByteArray, to save quint64 with QSettings? The problem is QVariant doesn't accept qint64 nor quint64.


Solution

  • QVariant supports qlonglong and qulonglong. As the documentation says, these are the same as qint64 and quint64. So you can just use QVariant::QVariant(qlonglong) and QVariant::toLongLong.