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

Qt Bridge should not write absolute positions and sizes inside Layouts

    XMLWordPrintable

Details

    • a6c3612a3 (master), 16bb05601 (qds/dev)
    • QDS Berlin - 2023 Week 49/50

    Description

      Using the example Figma project at QDS-7578, the generated code is

      import QtQuick
      import QtQuick.Layouts 1.15
      
      Rectangle {
          id: frame
          // ...
      
          RowLayout {
              id: frame_RowLayout
              anchors.left: parent.left
              anchors.right: parent.right
              anchors.top: parent.top
              anchors.bottom: parent.bottom
              anchors.bottomMargin: 20
              anchors.rightMargin: 30
              Rectangle {
                  id: green_Box
                  x: 30
                  y: 20
                  width: 100
                  height: 100
                  color: "#00ff00"
                  Layout.preferredWidth: 100
                  Layout.preferredHeight: 100
                  Layout.alignment: Qt.AlignLeft | Qt.AlignTop
              }
              // ...
          }
      }
      

       

      This produces qmllint warnings:

      Warning: Detected x on an item that is managed by a layout. This is undefined behavior; use Layout.leftMargin or Layout.rightMargin instead. [Quick.layout-positioning]
                  x: 30
                     ^^
      Warning: Detected y on an item that is managed by a layout. This is undefined behavior; use Layout.topMargin or Layout.bottomMargin instead. [Quick.layout-positioning]
                  y: 20
                     ^^
      Warning: Detected width on an item that is managed by a layout. This is undefined behavior; use implicitWidth or Layout.preferredWidth instead. [Quick.layout-positioning]
                  width: 100
                         ^^^
      Warning: Detected height on an item that is managed by a layout. This is undefined behavior; use implictHeight or Layout.preferredHeight instead. [Quick.layout-positioning]
                  height: 100
                          ^^^
      

      Attachments

        Issue Links

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

          Activity

            People

              vikas Vikas Pachdha
              skoh-qt Sze Howe Koh
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes