qtqmlspacing

Adjust vertical spacing in Flow in QML


I can adjust the horizontal spacing of elements inside a flow in QML, But i cannot adjust vertical spacing between elements

Suggest a way to adjust vertical spacing in QML

Vertical spacing in FLOW in QML

Is it possible to adjust vertical spacing?

CODE:

   Flow {
        id: FlowId
        width: 540
        spacing: 0
        Repeater {
            id: repeaterForButtons
            model:Model

            Button {
              id: rutton

              contentItem: Text {
                 text: text
                 font.pixelSize: 14
                 opacity: enabled ? 1.0 : 0.3
                 horizontalAlignment: Text.AlignHCenter
                 verticalAlignment: Text.AlignVCenter
                 elide: Text.ElideRight
               }

                background: Rectangle {
                  opacity: enabled ? 1 : 0.3
                  border.width: 1
                  radius: 2
               }
     }

OUTPUT:

enter image description here


Solution

  • Adding the below in the Rectangle object solves the issue

            background: Rectangle {
              ***anchors.fill: parent***
              opacity: enabled ? 1 : 0.3
              border.width: 1
              radius: 2
           }