Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How do you set a margin for Text Elements within A column within a Row?
Forum Update on Monday, May 27th 2025

How do you set a margin for Text Elements within A column within a Row?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    James Hankins
    wrote on last edited by
    #1

    I'm brand new to Qml and trying to sort through a margin issue. I wish to set a margin to push the Text elements away from the image. AppImage is a Felgo SDK enhancement of image. I would presume I could set the margin with the Text element with an anchors.leftMargin but that doesn't seem to work.

    delegate:     Rectangle {
                width: parent.width; height: 100
    
                Row {
    
    
                    AppImage {
                        id: id
                        fillMode: Image.PreserveAspectFit
                        source: "https://via.placeholder.com/80"
    
    
                    }
    
                    Column {
    
                        spacing: 5
                        Text { text: title
                            wrapMode: Text.WordWrap
                        }
                        Text { text: someValue}
                        Text { text: someValue2}
                    }
    
                }
    
            }
    
    1 Reply Last reply
    0
    • N Offline
      N Offline
      Nifiro
      wrote on last edited by
      #2

      https://doc.qt.io/qt-5/qml-qtquick-row.html#spacing-prop

      delegate: Rectangle {
                  width: parent.width; height: 100
      
                  Row {
                      spacing: 50   <========
      
                      AppImage {
                          id: id
                          fillMode: Image.PreserveAspectFit
                          source: "https://via.placeholder.com/80"
                      }
      
                      Column {
                          spacing: 5
                          Text {
                              text: title
                              wrapMode: Text.WordWrap
                          }
                          Text { text: someValue}
                          Text { text: someValue2}
                      }
                  }
              }
      
      J 1 Reply Last reply
      1
      • N Nifiro

        https://doc.qt.io/qt-5/qml-qtquick-row.html#spacing-prop

        delegate: Rectangle {
                    width: parent.width; height: 100
        
                    Row {
                        spacing: 50   <========
        
                        AppImage {
                            id: id
                            fillMode: Image.PreserveAspectFit
                            source: "https://via.placeholder.com/80"
                        }
        
                        Column {
                            spacing: 5
                            Text {
                                text: title
                                wrapMode: Text.WordWrap
                            }
                            Text { text: someValue}
                            Text { text: someValue2}
                        }
                    }
                }
        
        J Offline
        J Offline
        James Hankins
        wrote on last edited by
        #3

        @Nifiro said in How do you set a margin for Text Elements within A column within a Row?:

        spacing: 50

        Thanks! Couldn't see the forest for the trees. :)

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved