Custom type in QVariant converts to empty string
问题 I'm writing a lexical scanner that generates a stream of tokens from some input. Those tokens have a type and a value . Since I'm using Qt I chose to store the token data as a QVariant . This works pretty well for token data that is of a non-custom type. Unfortunately, I have several custom types that are stored inside of tokens as well. The tokens have a toString() function that outputs a token description (for debugging), but for all tokens that have data of a custom type this function