Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-15557

[Figma Bridge] Text elements should not be given fixed widths unless the designer specifies fixed widths

    XMLWordPrintable

Details

    Description

      See the attached project.

      Expected outcomes

      Actual outcomes

       

      The generated code contains Layout.preferredWidth: 31 which is wrong.

      Rectangle {
          id: notification
          width: 200
          height: 40
          color: "#00ccff"
          property alias labelText: label.text
      
          RowLayout {
              ...
              spacing: 10
              Item {
                  ...
                  Layout.fillWidth: true
              }
      
              Rectangle {
                  id: icon
                  color: "#0000cc"
                  Layout.preferredWidth: 20
                  Layout.preferredHeight: 20
                  Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
              }
      
              Text {
                  id: label
                  ...
                  text: qsTr("Label")
                  horizontalAlignment: Text.AlignLeft
                  verticalAlignment: Text.AlignTop
                  Layout.preferredWidth: 31
                  Layout.preferredHeight: 14
                  Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
              }
      
              Item {
                  ...
                  Layout.fillWidth: true
              }
          }
      }
      

       

      Other observations
      Even if we don't use auto-layouts and instead specify auto width for the text (see https://help.figma.com/hc/en-us/articles/27378154668951-Adjust-text-dimensions-and-resizing#h_01JB9SGE9C9982902T505EK7ZQ ), Qt Bridge (Importer) still generates width: 31. This is wrong.

      Attachments

        1. figma-labels-centered.png
          22 kB
          Sze Howe Koh
        2. qds-labels-notcentered.png
          6 kB
          Sze Howe Koh
        3. TextPositioningStudy.fig
          30 kB
          Sze Howe Koh
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            algerman Aleksei German
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes