I would like to convert QString values to float and then compare them..

I have used toFloat(), toDouble() , but it is not working.

Qt Code:
  1. QString version1 = "2.02.01";
  2. QString version 2 = "2.02.02"
  3. if(version1.toFloat() < version2.toFloat()) // just 2 is returned everytime.
  4. {
  5.  
  6. }
To copy to clipboard, switch view to plain text mode 

How to resolve it???