toString() does NOT return the value in the QVariant as a QString but rather describes the QVariant in a way that might be more suitable for debugging. I have found that QVariant::value() or QVariant::convert(QVariant::QString) seem to be more helpful, because they return the actual value in the QVariant.
– Mr. DeveloperdudeApr 03 '16 at 01:52
3
@LennartRolland [the code example in the docs](http://doc.qt.io/qt-4.8/qvariant.html#value) explicitly states `value()` is the same as `toString()`. They both use `canConvert()` and `convert()` internally.
– hamstergeneApr 03 '16 at 09:16
@hamstergene `toString()` appears to have begun working in qt 4.8; in qt 4.7, `value()` works, while `toString()` does not. So for this kind advice and compatibility, `value()` makes for a better general statement, unless qualified by version.
– fyngyrzOct 17 '16 at 22:43
This does not work for certain types. For instance, when the QVariant contains a QStringList, .toString() returns a null string.
– Thomas KlierAug 01 '23 at 10:29