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

QSettings behaviour changed due to the enhancement of the precision of FP conversion to string in QVariant

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.5.0
    • Core: I/O
    • None
    • Ubuntu 15.04 64bit

      Since I made an update from Qt 5.4.1 to Qt 5.5.0, QVariant::toString()-Method returns for example 6.5499999999999998 if it was initialized with double value 6.55. This is due to these changes https://codereview.qt-project.org/#/c/99815/

      One effect is that it is not possible to store a double value like this with QSettings and return it as a string exactly like it was stored.

      settings->setValue("interval", 6.55);
      qDebug() << settings->value("interval").toDouble(); // returns 6.55
      qDebug() << settings->value("interval").toString(); //returns 6.5499999999999998

      With Qt 5.4.1 toString()-Method returned 6.55 and I think this is more what users are expecting, when using QSettings to store double values.

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

            thiago Thiago Macieira
            cmoench Christoph Mönch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes