Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-78981

QGeoCoordinate equal operator returns true for unequal coordinates

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Invalid
    • Affects Version/s: 5.13.1
    • Fix Version/s: None
    • Component/s: Location, Positioning
    • Labels:
      None
    • Platform/s:
      All

      Description

      When comparing QGeoCoordinates with latitude +-90 and varying longitude then the equal operator returns true although the longitude values differ. The problem can be reproduced with this code:

      #include <QDebug>
      #include <QGeoCoordinate>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
          QGeoCoordinate coord(90, 180);
          for (int i=0; i<50; i++)
          {
              auto coord2 = QGeoCoordinate(coord.latitude(), coord.longitude()-i*0.1);
              qDebug() << coord << coord2 << (coord == coord2);
          }
          return 0;
      }
      

      which outputs:

      QGeoCoordinate(90, 180) QGeoCoordinate(90, 180) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179.9) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179.8) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179.7) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179.6) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179.5) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179.4) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179.3) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179.2) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179.1) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 179) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178.9) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178.8) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178.7) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178.6) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178.5) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178.4) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178.3) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178.2) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178.1) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 178) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177.9) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177.8) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177.7) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177.6) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177.5) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177.4) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177.3) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177.2) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177.1) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 177) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176.9) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176.8) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176.7) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176.6) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176.5) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176.4) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176.3) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176.2) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176.1) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 176) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 175.9) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 175.8) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 175.7) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 175.6) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 175.5) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 175.4) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 175.3) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 175.2) true
      QGeoCoordinate(90, 180) QGeoCoordinate(90, 175.1) true
      

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              paangele Paolo Angelelli
              Reporter:
              DanielSt Peter Staab
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes