07-26-2014 05:25 AM
While working on QVariant i noticed that in orde to access element of QVariant there are two ways:
QVariant tempQVariant; tempQVariant.value<QVariantList>
This will return the QVariantList which is stored inside QVariant. However there is another approach as:-
Please tell whats the difference between them and will there be difference in data returned from both of them.
Objective is to access QVariantMap stored inside QVariantList which is stored inside QVariant.
Thanks & Regards
07-26-2014 06:45 AM
If the QVariant type is a list then it will return a list in this respect it's no different from using toInt, toLong, etc.
There is little difference using either value or one of the toXXX functions and if you look at the documentation it says the same thing...
Depending on your code however using the toXXX functions you may be able to do away with using a validity check beforehand as you should do with value.