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. Spacing in ListView after header / before footer

Spacing in ListView after header / before footer

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 1.8k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    Leon_2001
    wrote on last edited by Leon_2001
    #1

    I everyone,

    it seems to me that if I have a list with a spacing, this spacing is not applied between the last element and the footer. How can I change this?
    I already tried in the footer anchors.marginLeft: 10,bit it diddn't help

    ListView {
                id: pictureListView
                Layout.preferredHeight: 100
                Layout.fillWidth: true
    
                orientation: ListView.Horizontal
                spacing: 10
    
                model: 4
    
                delegate: Rectangle {
                  height: 100; width: 100
                  color: "transparent"
                  border.color: "blue"
                }
    
                footer: Rectangle {
                  anchors.leftMargin: 10
                  height: 100; width: 100
    
                  Image {
                    anchors.fill: parent
                    source: "image://icons/add"
                  }
    
                  color: "transparent"
                  border.color: "blue"
                }
              }
    }
    
    
    raven-worxR 1 Reply Last reply
    0
    • L Leon_2001

      I everyone,

      it seems to me that if I have a list with a spacing, this spacing is not applied between the last element and the footer. How can I change this?
      I already tried in the footer anchors.marginLeft: 10,bit it diddn't help

      ListView {
                  id: pictureListView
                  Layout.preferredHeight: 100
                  Layout.fillWidth: true
      
                  orientation: ListView.Horizontal
                  spacing: 10
      
                  model: 4
      
                  delegate: Rectangle {
                    height: 100; width: 100
                    color: "transparent"
                    border.color: "blue"
                  }
      
                  footer: Rectangle {
                    anchors.leftMargin: 10
                    height: 100; width: 100
      
                    Image {
                      anchors.fill: parent
                      source: "image://icons/add"
                    }
      
                    color: "transparent"
                    border.color: "blue"
                  }
                }
      }
      
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Leon_2001
      anchros.leftMargin is only applied when you also set anchors.left
      you can wrap your current footer item in an Item and add a margin in there

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2
      • L Offline
        L Offline
        Leon_2001
        wrote on last edited by
        #3

        Thank you very much, it worked!

        I still fell like there should be a cleaner solution. Maybe provided by ListView itself? In fact, I actually ecspected this spacing to be default. Mayb there could be a property like bool applySpacingToFooter?
        What do you think about it?

        raven-worxR 1 Reply Last reply
        0
        • L Leon_2001

          Thank you very much, it worked!

          I still fell like there should be a cleaner solution. Maybe provided by ListView itself? In fact, I actually ecspected this spacing to be default. Mayb there could be a property like bool applySpacingToFooter?
          What do you think about it?

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @Leon_2001 said in Spacing in ListView after header / before footer:

          What do you think about it?

          well spacings belong between items. and your special usecase can be easily worked around.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0

          • Login

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