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

Widget double property values truncated/rounded by uic

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.7.1, 5.9.4, 5.11.1
    • Build tools: uic
    • None

    Description

      Observed specifically with QDoubleSpinBox (but most likely not limited to that).

      Typed/shown in Designer properties editor (decimals is default of 2):

      minimum:  -21474836.450000
      maximum:   21474836.650000
      

      XML (.ui file):

      <widget class="QDoubleSpinBox" name="A3">
          ...
        <property name="minimum">
         <double>-21474836.449999999254942</double>
        </property>
        <property name="maximum">
         <double>21474836.649999998509884</double>
        </property>
      </widget>
      

      Generated C++:

              A3->setMinimum(-2.14748e+7);
              A3->setMaximum(2.14748e+7);
      

      The result is incorrect min/max values. Workaround is to set them manually in C++ after UI setup.

      I'm guessing this is caused by
      uic/cpp/cppwriteinitialization.cpp:1410

              case DomProperty::Double:
                  propertyValue = QString::number(p->elementDouble());
                  break;
      

      Attachments

        For Gerrit Dashboard: QTBUG-70613
        # Subject Branch Project Status CR V

        Activity

          People

            jkobus Jarek Kobus
            mpaperno Maxim Paperno
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes