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

uic generates incorrect code to set QSizePolicy

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.5.1, 5.10.0
    • Build tools: uic
    • None

    Description

      When setting the QSizeProperty attributes using a .ui file, uic generates code which overrides the widget's original QSizeProperty::control type.

      For example:

       <widget class="QPushButton" name="example">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
       </widget>
      

      Generates:

              QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
              sizePolicy.setHorizontalStretch(0);
              sizePolicy.setVerticalStretch(0);
              sizePolicy.setHeightForWidth(example->sizePolicy().hasHeightForWidth());
              example->setSizePolicy(sizePolicy);
      

      The QSizePolicy should be constructed from the widget's existing QSizePolicy in order to preserve the QSizePolicy::controlType.

      ControlType.zip contains a failing unit test.

      Attachments

        1. ControlType.zip
          3 kB
          Nathan Collins
        2. example.ui
          0.3 kB
          Nathan Collins
        3. ui_5.10_example.h
          1 kB
          Nathan Collins
        4. ui_5.5_example.h
          1 kB
          Nathan Collins
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            nathan.collins Nathan Collins
            nathan.collins Nathan Collins
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes