title: Sort QStandardItemModel in c++ Qt
body: <p>I have a model of type QStandardItemModel which looks like this:</p>
  
  <pre><code>          QHash&lt;int, QByteArray&gt; roleNames;
            roleNames[Car2goVehicle::NameRole] =  "plate_number";
            roleNames[Car2goVehicle::DescriptionRole] = "address";
            roleNames[Car2goVehicle::FuelRole] = "fuel";
            roleNames[Car2goVehicle::InteriorRole] = "interior";
            roleNames[Car2goVehicle::ExteriorRole] = "exterior";
            roleNames[Car2goVehicle::VinRole] = "vin";
            roleNames[Car2goVehicle::LatRole] = "lat";
            roleNames[Car2goVehicle::LonRole] = "lon";
            roleNames[Car2goVehicle::DistanceRole] = "distance";
            d-&gt;m_vehiclesmodel = new RoleItemModel(roleNames);
  </code></pre>
  
  <p>and now I want to sort according to distance like this </p>
  
  <pre><code>           d-&gt;m_vehiclesmodel-&gt;setSortRole(Qt::UserRole);
             d-&gt;m_vehiclesmodel-&gt;sort(Car2goVehicle::DistanceRole, Qt::AscendingOrder);
  </code></pre>
  
  <p>But the result is wrong. Can somebody tell me how to sort ?</p>
  
  <p>Thanks.</p>