This should work. Conversion from QVariant is able to convert from int, bool ... and string (according to the doc)