I would go for the second solution. You can use QDataStream for the serialization if you want.