How can I convert QVariant to QString and Vice versa?
Thanks
Because C++ forbids unions from including types that have non-default constructors or destructors, most interesting Qt classes cannot be used in unions. Without QVariant, this would be a problem for QObject::property() and for database work, etc. A QVariant object holds a single value of a single typeId() at a time.
From string:
QString qs; QVariant qv(qs);
To string:
QString qs = qv.toString();
Tip: reading the help helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With